Skip to content

Instantly share code, notes, and snippets.

@information-security
Created January 10, 2022 00:47
Show Gist options
  • Save information-security/032b10609034f0eb6f14698da5140371 to your computer and use it in GitHub Desktop.
Save information-security/032b10609034f0eb6f14698da5140371 to your computer and use it in GitHub Desktop.
How to trigger a GitHub workflow/action of another repository
name: Dispatch receiver
on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]
# Allows you receive the dispatch
workflow_dispatch:
jobs:
build:
runs-on: self-hosted
steps:
- name: Clone the repo
uses: actions/checkout@v2}
# Other steps as per your requirements...
name: Dispatch sender
on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]
jobs:
build:
runs-on: self-hosted
steps:
- name: Clone the repo
uses: actions/checkout@v2}
# Other steps as per your requirements...
- name: Deploy Stage
uses: actions/github-script@v5
with:
github-token: ${{ secrets.MY_PAT_FOR_CALLEE_REPO }}
script: |
await github.rest.actions.createWorkflowDispatch({
'owner',
'repo_name',
'workflows/callee.yml',
'branch_name',
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment