Skip to content

Instantly share code, notes, and snippets.

@darksinge
Created August 24, 2020 21:40
Show Gist options
  • Save darksinge/f2b106fbc17f10c0194a5bfeef284fa2 to your computer and use it in GitHub Desktop.
Save darksinge/f2b106fbc17f10c0194a5bfeef284fa2 to your computer and use it in GitHub Desktop.
How to manually trigger a GitHub Action through the GitHub API
#!/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
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