Skip to content

Trigger a workflow from another workflow #26294

Answered by BrightRan
Andre601 asked this question in Actions
Discussion options

You must be logged in to vote

Yep, you can c****reate a repository dispatch event to trigger a workflow from another workflow.

For example, there 2 workflows ( wf1 and wf2 ), they can be in a same repository or different repositories. At the end of wf1, you can add an additional job to create a repository dispatch event via executing the GitHub REST API for the repository that cotains the wf2. And in wf2, you should set its trigger event as  on: repository_dispatch

A simple example:

NOTE: you need to create a new PAT instead of the automatically created GITHUB_TOKEN to authenticate the API. This new PAT should have permissions to access the repository that cotains wf2, and you aslo need to…

Replies: 7 comments 5 replies

Comment options

You must be logged in to vote
2 replies
@marcodicro-dp
Comment options

@shalva97
Comment options

Answer selected
Comment options

You must be logged in to vote
1 reply
@zpostfacto
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@epoctic
Comment options

@Andre601
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Product Feedback