Get branch name #25363
-
For context, this is my Github Actions ci.yml - https://github.com/reikdas/cling/blob/e9e6d80e3f15568d05a869ab1e314f453a857b96/.github/workflows/ci.yml I want to get the name of the branch that is creating a PR or the name of the branch a commit is pushed to (when Github Actions is triggered). I found separate solutions for PR branch and commit branch. Do I need to create separate steps for a pull request and a push? I don’t care about triggering both at the same time since I want push to be triggered only on master and pull request only on branches to master (as specified in the above linked ci.yml); so the two of them will never be triggered together. I would really appreciate any help with this :slight_smile: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
reikdas:
My answer is yes. As the two events push and pull_request have different event payload , I would recommend you add two steps to get PR branch and push commit branch. You could add if conditional to these two steps:
and
|
Beta Was this translation helpful? Give feedback.
My answer is yes. As the two events push and pull_request have different event payload , I would recommend you add two steps to get PR branch and push commit branch. You could add if conditional to these two steps:
and