Skip to content

Trigger workflows across repositories using the repository_dispatch event. A lightweight GitHub Action to broadcast custom events.

License

Notifications You must be signed in to change notification settings

saedyousef/repository-dispatch

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” repository-dispatch

A reusable GitHub Action to trigger workflows in another repository using the repository_dispatch event.

This action allows you to broadcast custom events (with optional payloads) from one repository to another β€” ideal for staging deployments, cross-repo coordination, or multi-service automation.


πŸš€ Usage

πŸ”§ Step 1: Setup the Target Repository (Receiver)

In the target repo (e.g., app-service), add a workflow like this:

# .github/workflows/on-dispatch.yml
name: React to Repository Dispatch

on:
  repository_dispatch:
    types: [example-event]

jobs:
  handle-event:
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo "Triggered by: ${{ github.event_name }}"
          echo "Branch: ${{ github.event.client_payload.branch }}"
          echo "Source: ${{ github.event.client_payload.triggered_by }}"

πŸ“€ Step 2: Use in Source Repository (Sender)

- name: Trigger dispatch in target repo
  uses: saedyousef/repository-dispatch@v0.1
  with:
    token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
    owner: your-org
    repo: app-service
    event_type: example-event
    client_payload: '{"key": "value", "key2": "value2"}'

πŸ” token must be a Personal Access Token (PAT) with repo scope (especially for private repos).

πŸ“₯ Inputs

Name Required Description
token βœ… πŸ” Must be a Personal Access Token (PAT) with repo scope (private repos)
owner βœ… Owner of the target repository
repo βœ… Name of the target repository
event_type βœ… Custom event type to trigger in the target repo
client_payload ❌ JSON object as a string with optional data

πŸ“„ License

This project is licensed under the MIT License. Β© 2025 Saed Yousef

About

Trigger workflows across repositories using the repository_dispatch event. A lightweight GitHub Action to broadcast custom events.

Topics

Resources

License

Stars

Watchers

Forks

Languages