Tag Archives: GitHub Actions

GitHub Actions – Cross Repository Event Triggering with Repository Dispatch

What repository_dispatch can do in this post: When some tasks finish processing in repository A. Send a webhook payload to trigger GitHub Actions in repository B.

In .github/workflows/build.yml from repository A:

    - name: Notify project-b
      if: github.event_name != 'pull_request'
      run: |
        curl -X POST -H "Accept: application/vnd.github.v3+json" \
          -H "Authorization: Bearer ${{ secrets.PAT_SPARANOID }}" \
          https://api.github.com/repos/sparanoid/project-b/dispatches \
          -d '{"event_type":"webhook"}'

In .github/workflows/build.yml from repository B:

name: Build

on:
  # ... other options
  repository_dispatch:
    types:
      - webhook

# ...
jobs:
  build:
    # do your staff...