Skip to content

iniva/action-repository-dispatch

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

CI for Repository Dispatch CI

Action: Repository Dispatch

Send repository_dispatch events with custom payloads

Usage

  • ℹ️ Check the ci workflow in this repo to see a live example on how to use this action in your own workflow
  • Check the Inputs sections for more details

Inputs

Input Description Required Default Comments
eventType Custom event type expected by the receiving repository Yes example: 'do-something-awesome'
token A GitHub Personal Access Token (PAT) Yes PAT requirements
targetRepository Full name (owner/repo-name) of the repository
that will receive the repository_dispatch event
No github.repository default: current repository running the workflow
payloadType Type of payload provided.

Types: string, path, url
No string --
payload Stringified JSON payload.
Required when payloadType is not provided or provided as "string"
No '{}' example:
'{"customField": "some value", "anotherField": "another value"}'
payloadPath Path to file with JSON payload.
Required when payloadType is provided as "path"
No example: path/to/valid.json
payloadUrl URL to JSON payload.
Required when payloadType is provided as "url"
No example: https://example.com/valid.json

Examples

These are the 3 supported formats to send custom payloads

String

  - uses: iniva/action-repository-dispatch
    name: Dispatch Event
    id: dispatch_action
    with:
      eventType: 'test_dispatch'
      token: ${{ secrets.REPO_PAT }}
      payload: '{"requested_by": "${{github.actor}}"}'

Path

  - uses: iniva/action-repository-dispatch
    name: Dispatch Event
    id: dispatch_action
    with:
      eventType: 'test_dispatch'
      token: ${{ secrets.REPO_PAT }}
      payloadType: path
        payloadPath: path/to/valid.json

URL

  - uses: iniva/action-repository-dispatch
    name: Dispatch Event
    id: dispatch_action
    with:
      eventType: 'test_dispatch'
      token: ${{ secrets.REPO_PAT }}
      payloadType: url
      payloadUrl: https://example.com/valid.json

PAT requirements

ℹ️ If you are targeting:

  • Public repository: The PAT only needs public_repo scope
  • Private repository: The PAT needs repo scope and its owner needs write access in the target repository

DEBUG

To enable step debug logging, set the following secret in the repository that's running the workflow:

  • Secret name: ACTIONS_STEP_DEBUG
  • value: true

About

Send repository_dispatch events with custom payloads

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published