fix: check out correct branch on pull_request events#244
Merged
andrii-bodnar merged 2 commits intocrowdin:masterfrom Sep 6, 2024
Merged
fix: check out correct branch on pull_request events#244andrii-bodnar merged 2 commits intocrowdin:masterfrom
andrii-bodnar merged 2 commits intocrowdin:masterfrom
Conversation
georeith
commented
Sep 5, 2024
| git config --global user.email "${INPUT_GITHUB_USER_EMAIL}" | ||
| git config --global user.name "${INPUT_GITHUB_USER_NAME}" | ||
|
|
||
| if [ "$INPUT_SKIP_REF_CHECKOUT" != true ] && [ ${GITHUB_REF#refs/heads/} != $GITHUB_REF ]; then |
Contributor
Author
There was a problem hiding this comment.
I believe this check: [ ${GITHUB_REF#refs/heads/} != $GITHUB_REF ] was trying to prevent a git checkout error that would occur if this ran on an event type (e.g., pull_request) whose GITHUB_REF is not set to refs/heads/head.
and should be unnecessary now as this should always be able to resolve to a value that can be checked out
andrii-bodnar
approved these changes
Sep 6, 2024
Member
andrii-bodnar
left a comment
There was a problem hiding this comment.
LGTM, @georeith thank you for the contribution!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: #242
Uses
GITHUB_HEAD_REFif available (which points to the head onpull_requestevent triggers) and falls back to${GITHUB_REF#refs/heads/}or${GITHUB_REF#refs/tags/}otherwise.As per the docs,
GITHUB_REFhas 3 possible values:refs/pull/<pr_number>/merge:pull_requestevents whereGITHUB_HEAD_REFis set to the actual headrefs/tags/<tag_name>:releaseevents, this PR extracts the tag_name and checks that outrefs/heads/<branch_name>: all other events such aspush