Skip to content

Instantly share code, notes, and snippets.

@maxisam
Forked from Daniel-ltw/from.yaml
Created February 7, 2022 17:04
Show Gist options
  • Save maxisam/02592f01f9a873c683cf7f313f202fa4 to your computer and use it in GitHub Desktop.
Save maxisam/02592f01f9a873c683cf7f313f202fa4 to your computer and use it in GitHub Desktop.
Github Actions repository_dispatch example
name: Build Artifacts
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: call the other repo
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EVENT: YOUR_EVENT_TYPE
ORG: YOUR_ORG_NAME
REPO: YOUR_REPO_NAME
run: |
curl -d "{\"event_type\": \"${EVENT}\"}" -H "Content-Type: application/json" -H "Authorization: token ${GITHUB_TOKEN}" -H "Accept: application/vnd.github.everest-preview+json" "https://api.github.com/repos/${ORG}/${REPO}/dispatches"
name: dispatch receiver
on: [repository_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: dispatch trigger
if: github.event.action == "YOUR_EVENT_TYPE"
run: |
echo "repository_dispatch triggered"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment