How to trigger different action only on merge #25354
-
Hey, I’m having a problem implementing my workflow in a single action file: I want to run: * only step1 on every push to feature branch (other than master) * only step1 on a pull request * step1 and step2 on merge This is my pipeline:
I can implement my requirements with 2 files but I would like to keep it in one if that is possible. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
Hi @danielinclouds , Merge pull request will not trigger the workflow. By default, the pull_request’s activity type is opened, synchronize, and reopened. Hence you need to add ‘closed’ type for pull request event. Code sample as below:
Hope it’s clear and helpful! |
Beta Was this translation helpful? Give feedback.
-
Thanks, @weide-zhou that was exactly what I was looking for. |
Beta Was this translation helpful? Give feedback.
-
Thanks! I’d been looking for this for a while. |
Beta Was this translation helpful? Give feedback.
-
weide-zhou:
There are some styling that mess up with the readability of your answer :slight_smile: |
Beta Was this translation helpful? Give feedback.
-
Thanks @Vadorequest, this is caused by the community forum update, i tried but cannot edit the code. You can ignore the styling code like |
Beta Was this translation helpful? Give feedback.
Hi @danielinclouds ,
Merge pull request will not trigger the workflow. By default, the pull_request’s activity type is opened, synchronize, and reopened. Hence you need to add ‘closed’ type for pull request event. Code sample as below:
Hope it’s clea…