Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Favour GITHUB_HEAD_REF for branch name when present (pull requests) #8

Merged
merged 2 commits into from
Jun 24, 2020

Conversation

BDQ
Copy link
Contributor

@BDQ BDQ commented Jun 24, 2020

For actions triggered on pull_request, the GITHUB_REF does not contain the branch name it generally looks something like 0371/merge - resulting in workflow API calls returning no run data.

This change will use GITHUB_HEAD_REF as the first preference for the branch name when it is present (it is only present in pull request actions). Relevant snippet from the Actions docs
image

@BDQ
Copy link
Contributor Author

BDQ commented Jun 24, 2020

I've run a few test actions to show the before/after states - and confirm no regression.

pull_request trigger - current v1 release - Not waiting
(BAD): https://github.com/BDQ/test-actions/runs/804677535?check_suite_focus=true
(First run, which should have blocked it): https://github.com/BDQ/test-actions/runs/804677034?check_suite_focus=true

pull_request trigger - with PR changes - waiting correctly
(GOOD): https://github.com/BDQ/test-actions/runs/804668836?check_suite_focus=true

Non pull_request trigger - with PR changes - still works
(STILL GOOD): https://github.com/BDQ/test-actions/runs/804637766?check_suite_focus=true

@softprops
Copy link
Owner

Nice catch. I rarely use pull_request events and just use pushes to pull requested branches so I missed this

@softprops
Copy link
Owner

updated the latest tag with this change

@BDQ BDQ deleted the support-pull-requests branch November 9, 2020 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants