Created
August 24, 2020 21:40
-
-
Save darksinge/f2b106fbc17f10c0194a5bfeef284fa2 to your computer and use it in GitHub Desktop.
How to manually trigger a GitHub Action through the GitHub API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Get the <token> through the GitHub website: | |
# 1. Go to Settings->Developer Settings->Personal access tokens | |
# 2. Create a token with the 'repo' scope selected. | |
# https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token | |
# The value for "event_type" should match "on.repository_dispatch.type" in workflow.yaml. | |
curl -X POST \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
-H "Authorization: token <token>" \ | |
-d '{"event_type": "my-special-event-type"}' \ | |
https://api.github.com/repos/$OWNER/$REPO/dispatches |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: My Workflow | |
on: | |
repository_dispatch: | |
type: my-special-event-type | |
jobs: | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment