4

Trigger workflow only on pull request MERGE

 1 year ago
source link: https://github.community/t/trigger-workflow-only-on-pull-request-merge/17359/3
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Trigger workflow only on pull request MERGE

I saw many posts about people asking if there is a way to trigger the workflow only on MERGE, which to me seems the most useful. However I did not see any answer, so I would like to find a solution.

At the moment I am stuck with:

on:
  pull_request:
    types: [closed]

Which is not ideal, as it would trigger the entire process even if I dismiss or close the PR without merging and I cannot see any reason on why this should happen.

I saw also: 

github.event.pull_request.merged == true

but as my understanding this would run only for a particular action not on the entire workflow.

So my question is: how can I trigger a workflow only on pull_request merge?

Thanks

There’s no way to specify that a workflow should be triggered when a pull request is merged. However, because a merged pull request always results in a push, you can use the push event to accomplish your goal. For example, let’s say that you want to run a workflow whenever a pull request is merged …


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK