Created
January 10, 2022 00:47
-
-
Save information-security/032b10609034f0eb6f14698da5140371 to your computer and use it in GitHub Desktop.
How to trigger a GitHub workflow/action of another repository
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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