Action runs when PR is created, but not when PR is merged #25073
-
Hi, This is the same issue as described in support ticket 358105, but it’s been 11 days and I haven’t had any reply on that ticket. I have links to relevant PR’s and stuff in that ticket if any staff would find those useful. I have a GitHub action which runs when a PR is created, and runs when I add reviewers to the PR, all of which is expected. But it does not run when the PR gets merged. And given that this is the jessfraz branch cleanup action, the only relevant event for this action is when a PR gets merged. When a PR gets merged, there’s no logs or any indication in the ‘Actions’ UI that the action runs, though I do see logs for it when a PR is created and reviewers are added. Note that this worked great on the old HCL system, then it stopped running entirely for all events a few weeks ago. I have since migrated it to YAML and it now runs when a PR is created, but not when the PR is merged. In case of any of that is relevant. Anybody know why this isn’t running when a PR gets merged? Thanks. Here’s my YAML:
|
Beta Was this translation helpful? Give feedback.
Replies: 11 comments
-
By default a workflow is run when a PR is opened, synchronized or reopened to better optimize for CI workflows. If you want to run when the PR is merged you can specify that as follows.
Since events are not really individual events but are a set of events that could occur on a givne resources (at lest mostly). Using the types: field you can filter against the action element in the payload. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your reply. I adjusted my
|
Beta Was this translation helpful? Give feedback.
-
Should that be ‘closed’? e.g.:
According to the docs there isn’t a ‘merged’ type for a pull_request action: |
Beta Was this translation helpful? Give feedback.
-
@jrobison-sb - @talldan was exactly right, it should be However, even that’s not going to work right now as you’ve uncovered a bug in the system where actions aren’t triggering on a closed PR even when they should be (using this exact setup). I’ve been able to recreate it and I have a fix in the works. I’ll report back here when I have something deployed and working! (btw, I’m an engineer on the Actions team, not sure if my profile says that) |
Beta Was this translation helpful? Give feedback.
-
Thanks @cdb, that fix and the |
Beta Was this translation helpful? Give feedback.
-
Awesome @talldan, good to know! Fixing things makes me happy too :) @jrobison-sb The immediate bug is deployed and working now. It uncovered another issue which I’m going to work on, but the workaround is to simply remove the following line completely:
It’s not working right now in this use case (something we have to fix on our side), but for this specific action you don’t actually have to checkout your code so removing it should get things running I believe! |
Beta Was this translation helpful? Give feedback.
-
@ cbd Thanks for identifying this, and thanks for the super quick turn around time on the fix. It’s working again as expected. |
Beta Was this translation helpful? Give feedback.
-
Would it be possible to create a |
Beta Was this translation helpful? Give feedback.
-
And what about checkout? Is there any workaround if I need to get the code from the merged branch for the pipeline? |
Beta Was this translation helpful? Give feedback.
-
are there any updates? I’m just trying excute workflow when PR merged. But it doesn’t kicked from platform… https://github.com/vvakame/til/blob/master/.github/workflows/pr-to-blog.yml |
Beta Was this translation helpful? Give feedback.
-
If I’m reading the documentation correctly, closed will trigger on any reason for closing a PR, so my action could be triggered when a PR is closed without merging which is not what I need. Am I missing something? Is there a way to trigger the action on a closed PR that has been merged? |
Beta Was this translation helpful? Give feedback.
Awesome @talldan, good to know! Fixing things makes me happy too :)
@jrobison-sb The immediate bug is deployed and working now. It uncovered another issue which I’m going to work on, but the workaround is to simply remove the following line completely:
It’s not working right now in this use case (something we have to fix on our side), but for this specific action you don’t actually have to checkout your code so removing it should get things running I believe!