A GitHub action to create a repository dispatch event
  • TypeScript 84.4%
  • JavaScript 15.6%
Find a file
dependabot[bot] 0e0cf047c0
build(deps-dev): bump the npm group with 5 updates (#450)
Bumps the npm group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [eslint-plugin-prettier](https://github.com/prettier/eslint-plugin-prettier) | `5.5.5` | `5.5.6` |
| [jest](https://github.com/jestjs/jest/tree/HEAD/packages/jest) | `30.3.0` | `30.4.2` |
| [jest-circus](https://github.com/jestjs/jest/tree/HEAD/packages/jest-circus) | `30.3.0` | `30.4.2` |
| [js-yaml](https://github.com/nodeca/js-yaml) | `4.1.1` | `4.2.0` |
| [ts-jest](https://github.com/kulshekhar/ts-jest) | `29.4.9` | `29.4.11` |


Updates `eslint-plugin-prettier` from 5.5.5 to 5.5.6
- [Release notes](https://github.com/prettier/eslint-plugin-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-plugin-prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/eslint-plugin-prettier/compare/v5.5.5...v5.5.6)

Updates `jest` from 30.3.0 to 30.4.2
- [Release notes](https://github.com/jestjs/jest/releases)
- [Changelog](https://github.com/jestjs/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jestjs/jest/commits/v30.4.2/packages/jest)

Updates `jest-circus` from 30.3.0 to 30.4.2
- [Release notes](https://github.com/jestjs/jest/releases)
- [Changelog](https://github.com/jestjs/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jestjs/jest/commits/v30.4.2/packages/jest-circus)

Updates `js-yaml` from 4.1.1 to 4.2.0
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/commits)

Updates `ts-jest` from 29.4.9 to 29.4.11
- [Release notes](https://github.com/kulshekhar/ts-jest/releases)
- [Changelog](https://github.com/kulshekhar/ts-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/kulshekhar/ts-jest/compare/v29.4.9...v29.4.11)

---
updated-dependencies:
- dependency-name: eslint-plugin-prettier
  dependency-version: 5.5.6
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
- dependency-name: jest
  dependency-version: 30.4.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: jest-circus
  dependency-version: 30.4.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: js-yaml
  dependency-version: 4.2.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm
- dependency-name: ts-jest
  dependency-version: 29.4.11
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-02 04:59:03 +00:00
.github build(deps): bump the github-actions group with 2 updates (#442) 2026-03-01 09:43:01 +00:00
dist build(deps): bump @tootallnate/once and jest (#443) 2026-03-06 08:19:48 +00:00
src fix: deprecation of @octokit/request-error error.code (#245) 2023-09-05 18:57:07 +09:00
.eslintignore Update eslint config 2020-05-04 18:20:48 +09:00
.eslintrc.json fix: remove unnecessary prettier config 2021-03-16 12:46:48 +09:00
.gitignore Update gitignore 2020-05-04 18:20:48 +09:00
.prettierignore Add prettier config 2020-05-04 18:20:48 +09:00
.prettierrc.json Add prettier config 2020-05-04 18:20:48 +09:00
action.yml Fix node version in actions.yml (#433) 2025-11-14 14:57:18 +00:00
jest.config.js Add jest config 2020-05-04 18:20:48 +09:00
LICENSE Initial commit 2019-11-08 10:12:38 +09:00
package-lock.json build(deps-dev): bump the npm group with 5 updates (#450) 2026-06-02 04:59:03 +00:00
package.json build(deps-dev): bump the npm group with 5 updates (#450) 2026-06-02 04:59:03 +00:00
README.md docs: update readme 2025-10-01 16:20:14 +01:00
tsconfig.json Convert to Typescript 2020-05-04 18:20:48 +09:00

Repository Dispatch

CI GitHub Marketplace

A GitHub action to create a repository dispatch event.

Usage

Dispatching an event to the current repository

In the caller workflow file:

jobs:
  Dispatch:
    runs-on: ubuntu-latest
    permissions:
      contents: write
     steps:
       - name: Repository Dispatch
         uses: peter-evans/repository-dispatch@v4
         with:
           event-type: my-event

In the callee workflow file:

name: MyWorkflow

on:
  repository_dispatch:
    types: [my-event]

Dispatching an event to a remote repository

Use a repo scoped Personal Access Token (PAT).

      - name: Repository Dispatch
        uses: peter-evans/repository-dispatch@v4
        with:
          token: ${{ secrets.PAT }}
          repository: username/my-repo
          event-type: my-event

Action inputs

Name Description Default
token GITHUB_TOKEN or a repo scoped Personal Access Token (PAT). See token for further details. GITHUB_TOKEN
repository The full name of the repository to send the dispatch. github.repository (current repository)
event-type (required) A custom webhook event name.
client-payload JSON payload with extra information about the webhook event that your action or workflow may use. {}

Token

This action creates repository_dispatch events. The default GITHUB_TOKEN token can only be used if you are dispatching the same repository that the workflow is executing in.

To dispatch to a remote repository you must create a Personal Access Token (PAT) with the repo scope and store it as a secret. If you will be dispatching to a public repository then you can use the more limited public_repo scope.

You can also use a fine-grained personal access token (beta). It needs the following permissions on the target repositories:

  • contents: read & write
  • metadata: read only (automatically selected when selecting the contents permission)

Example

Here is an example setting all of the input parameters.

      - name: Repository Dispatch
        uses: peter-evans/repository-dispatch@v4
        with:
          token: ${{ secrets.PAT }}
          repository: username/my-repo
          event-type: my-event
          client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'

Here is an example on: repository_dispatch workflow to receive the event. Note that repository dispatch events will only trigger a workflow run if the workflow is committed to the default branch.

name: Repository Dispatch
on:
  repository_dispatch:
    types: [my-event]
jobs:
  myEvent:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ github.event.client_payload.ref }}
      - run: echo ${{ github.event.client_payload.sha }}

Dispatch to multiple repositories

You can dispatch to multiple repositories by using a matrix strategy. In the following example, after the build job succeeds, an event is dispatched to three different repositories.

jobs:
  build:
    # Main workflow job that builds, tests, etc.

  dispatch:
    needs: build
    strategy:
      matrix:
        repo: ['my-org/repo1', 'my-org/repo2', 'my-org/repo3']
    runs-on: ubuntu-latest
    steps:
      - name: Repository Dispatch
        uses: peter-evans/repository-dispatch@v4
        with:
          token: ${{ secrets.PAT }}
          repository: ${{ matrix.repo }}
          event-type: my-event

Client payload

The GitHub API allows a maximum of 10 top-level properties in the client-payload JSON. If you use more than that you will see an error message like the following.

No more than 10 properties are allowed; 14 were supplied.

For example, this payload will fail because it has more than 10 top-level properties.

client-payload: ${{ toJson(github) }}

To solve this you can simply wrap the payload in a single top-level property. The following payload will succeed.

client-payload: '{"github": ${{ toJson(github) }}}'

Additionally, there is a limitation on the total data size of the client-payload. A very large payload may result in a client_payload is too large error.

Multiline

A multiline client-payload can be set directly in YAML, as in the following example.

      - name: Repository Dispatch
        uses: peter-evans/repository-dispatch@v4
        with:
          token: ${{ secrets.PAT }}
          repository: username/my-repo
          event-type: my-event
          client-payload: |-
            {
              "repo": {
                "name": "${{ github.repository }}",
                "branch": "${{ needs.build_cfg.outputs.REPO_BRANCH }}",
                "tag": "${{ needs.build_cfg.outputs.REPO_TAG }}"
              },
              "deployment": {
                "project": "${{ env.MY_PROJECT }}",
                "container": "${{ env.MY_CONTAINER }}",
                "deploy_msg": "${{ env.SLACK_DEPLOY_MSG }}",
              }
            }

License

MIT