GITHUB_HEAD_REF is inconsistent #25773
-
Opposite from this topic: GITHUB_REF is inconsistent Issue:
Workflow that requires this:There are branch protection rules in place on master to prevent anyone (including the GitHub action as we can’t exclude it) from pushing to master. So the file that gets changed within the action needs to be pushed to the pull request incoming branch. We also require pull requests be approved by a reviewer before they can be merged. So we do not want this to fire on a pull_request, but only on the pull_request_review (since no pull_request_approved event exists) I verified this behavior by echoing both github.head_ref and github.ref for a pull_request event, and in a separate pull request for the event pull_request_review. Any help is appreciated |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Hi @SamuraiTheNinja, welcome to the GitHub Support Community! Is it the head ref you’re looking for? I think you’ll be able to get this from inside the There’s example payloads for the webhook events that trigger workflows on this page so I’d recommend double checking that this is what you’re looking for. |
Beta Was this translation helpful? Give feedback.
-
Thank you @thomasshaped that has solved the problem I was having. Finding the right documentation for most of GitHub Actions has been a nightmare, so I really appreciate the help! |
Beta Was this translation helpful? Give feedback.
-
Hey can you guys help me with the following thing
the problem is that none of my job triggers when I create a pull request against the following branches posted in my code. can you guys please help me with this CC: @ThomasShaped1 |
Beta Was this translation helpful? Give feedback.
Hi @SamuraiTheNinja, welcome to the GitHub Support Community! Is it the head ref you’re looking for? I think you’ll be able to get this from inside the
github.event
context atgithub.event.pull_request.head.ref
for both of these.There’s example payloads for the webhook events that trigger workflows on this page so I’d recommend double checking that this is what you’re looking for.