All Projects → peter-evans → Repository Dispatch

peter-evans / Repository Dispatch

Licence: mit
A GitHub action to create a repository dispatch event

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Repository Dispatch

commit-comment
A GitHub action to create a comment for a commit on GitHub
Stars: ✭ 62 (-77.86%)
Mutual labels:  github-api
action-sync-node-meta
GitHub Action that syncs package.json with the repository metadata.
Stars: ✭ 25 (-91.07%)
Mutual labels:  github-api
Github cli
GitHub on your command line. Use your terminal, not the browser.
Stars: ✭ 263 (-6.07%)
Mutual labels:  github-api
twgitbot
A node.js bot that checks a github repo changes and tweets it to your Twitter account
Stars: ✭ 10 (-96.43%)
Mutual labels:  github-api
vue-blog
使用 Vue 和 Github Issues 搭建的 SPA Blog
Stars: ✭ 18 (-93.57%)
Mutual labels:  github-api
ghexport
Export your Github activity: events, repositories, stars, etc.
Stars: ✭ 18 (-93.57%)
Mutual labels:  github-api
meet-the-fans
Query and Visualize the network graph of your GitHub repositories, followers, stargazers, and forks.
Stars: ✭ 22 (-92.14%)
Mutual labels:  github-api
Buildapks
Really quickly build APKs on handheld device (smartphone and tablet) in Amazon, Android, Chromebook, PRoot and Windows📲 See https://buildapks.github.io/docsBuildAPKs/setup to start building APKs.
Stars: ✭ 272 (-2.86%)
Mutual labels:  github-api
mighty-watcher
Open source made easier
Stars: ✭ 44 (-84.29%)
Mutual labels:  github-api
Node Github Profile Summary
[Temporarily unavailable]The node version of github-profile-summary with GraphQL
Stars: ✭ 261 (-6.79%)
Mutual labels:  github-api
travis-activate
Activates Travis-CI builds for all repos in a given GitHub project
Stars: ✭ 20 (-92.86%)
Mutual labels:  github-api
Track-Stargazers
Have fun tracking your project's stargazers
Stars: ✭ 38 (-86.43%)
Mutual labels:  github-api
git-server
A GitHub Protocol & API emulation
Stars: ✭ 68 (-75.71%)
Mutual labels:  github-api
glare
gracefully download (latest) releases from GitHub
Stars: ✭ 64 (-77.14%)
Mutual labels:  github-api
Gitlit
Platform to connect contributors and projects based on skill level and shared interests.
Stars: ✭ 265 (-5.36%)
Mutual labels:  github-api
quick-add-github-issue-browser-extension
Quickly add GitHub issues direct from a browser button
Stars: ✭ 14 (-95%)
Mutual labels:  github-api
github-vacations
Automagically ignore all notifications related to work when you are on vacations
Stars: ✭ 20 (-92.86%)
Mutual labels:  github-api
Repository Hunter
🌹 Making GitHub more socially engaging 🎮 and fun 🍥 for all
Stars: ✭ 273 (-2.5%)
Mutual labels:  github-api
Githubfollows
A demo project based on MVVM architecture and material design & animations.
Stars: ✭ 272 (-2.86%)
Mutual labels:  github-api
Forkhub
GitHub client for Android based on the abandoned official app
Stars: ✭ 2,756 (+884.29%)
Mutual labels:  github-api

Repository Dispatch

CI GitHub Marketplace

A GitHub action to create a repository dispatch event.

Usage

      - name: Repository Dispatch
        uses: peter-evans/[email protected]
        with:
          token: ${{ secrets.REPO_ACCESS_TOKEN }}
          event-type: my-event

Action inputs

Name Description Default
token (required) A repo scoped GitHub Personal Access Token. See token for further details.
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 does not have scopes to do this so a repo scoped PAT created on a user with write access to the target repository is required. If you will be dispatching to a public repository then you can use the more limited public_repo scope.

Example

Here is an example setting all of the input parameters.

      - name: Repository Dispatch
        uses: peter-evans/[email protected]
        with:
          token: ${{ secrets.REPO_ACCESS_TOKEN }}
          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 (usually master).

name: Repository Dispatch
on:
  repository_dispatch:
    types: [my-event]
jobs:
  myEvent:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/[email protected]
        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/[email protected]
        with:
          token: ${{ secrets.REPO_ACCESS_TOKEN }}
          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.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].