Does a pull_request merge always trigger the push event? #27017
-
Hello all, My intention is to trigger a CI workflow whenever files in master change. Initially I defined the following triggers:
When I do this every PR close with changes triggers the job twice, which I did not expect. Does a PR close with changes always trigger a push event? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi @actuallymentor , According to the configured events for your workflow, it is normal that the workflow was triggered twice. Once the changes are merged to master branch via the PR, the PR will be closed automatically, so the event on.pull_request.closed will trigger the workflow once. Because of having changes are pushed to master branch, the event on.push will trigger the workflow once. That’s why the workflow will be triggered twice. If you want the workflow is triggered only when some changes are pushed to master branch, you just need to setup the push event for your workflow, and without pull_request event.
|
Beta Was this translation helpful? Give feedback.
-
So to summarize: yes an ‘on.pull_request.close’ always triggers a ‘push’ event |
Beta Was this translation helpful? Give feedback.
-
No, because a pull request can be closed without merging it and so there would be no push event in that case. |
Beta Was this translation helpful? Give feedback.
Hi @actuallymentor ,
According to the configured events for your workflow, it is normal that the workflow was triggered twice.
Once the changes are merged to master branch via the PR, the PR will be closed automatically, so the event on.pull_request.closed will trigger the workflow once. Because of having changes are pushed to master branch, the event on.push will trigger the workflow once.
That’s why the workflow will be triggered twice.
If you want the workflow is triggered only when some changes are pushed to master branch, you just need to setup the push event for your workflow, and without pull_request event.