Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/myrotvorets/trigger-repository-dispatch-action
GitHub action to trigger a repository_dispatch event
https://github.com/myrotvorets/trigger-repository-dispatch-action
ci github-action repository-dispatch
Last synced: 22 days ago
JSON representation
GitHub action to trigger a repository_dispatch event
- Host: GitHub
- URL: https://github.com/myrotvorets/trigger-repository-dispatch-action
- Owner: myrotvorets
- License: mit
- Created: 2020-12-23T23:35:37.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-14T00:04:55.000Z (3 months ago)
- Last Synced: 2024-10-14T14:00:36.580Z (3 months ago)
- Topics: ci, github-action, repository-dispatch
- Language: TypeScript
- Homepage:
- Size: 1.5 MB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Trigger repository_dispatch Action
Triggers a [`repository_dispatch`](https://docs.github.com/en/free-pro-team@latest/rest/reference/repos#create-a-repository-dispatch-event) event for the given repository.
## Inputs
| Name | Default | Required? | Description |
| --------- | ------------------- | --------- | ----------- |
| `token` | | **YES** | A [Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) with `repo` scope |
| `repo` | `github.repository` | No | The name of the repository to send the event (`owner/repo`) |
| `type` | | **YES** | A custom webhook event name |
| `payload` | | No | JSON payload with extra information about the webhook event that your action or workflow may use. GitHub API allows for a maximum of 10 top-level properties |## Example usage
In the workflow that needs to trigger a `repository_dispatch` action:
```yaml
- name: Repository Dispatch
uses: myrotvorets/[email protected]
with:
token: ${{ secrets.REPOSITORY_ACCESS_TOKEN }}
repo: username/my-repo
type: my-custom-event
payload: '{ "ref": "${{ github.ref }}", "sha": "${{ github.sha }}" }'
```A workflow that handles `repository_dispatch` action:
```yaml
name: Repository Dispatch
on:
repository_dispatch:
types:
- my-custom-event
jobs:
handle-dispatch:
runs-on: ubuntu-latest
steps:
- name: Print commit hash
run: echo ${{ github.event.client_payload.sha }}- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.client_payload.ref }}
```