Last active
December 16, 2020 20:50
-
-
Save namikingsoft/ff8571ac3aed419c9bd69f57eb7d5c9e to your computer and use it in GitHub Desktop.
Fetch base sha1 from github pull request number
This file contains 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
GITHUB_PR_NUMBER=1234 | |
base_branch_sha1() { | |
MERGED_BRANCH="pull/${GITHUB_PR_NUMBER}/merge" | |
git fetch origin "${MERGED_BRANCH}:${MERGED_BRANCH}" > /dev/null | |
git log "${MERGED_BRANCH}" --oneline | head -n1 | sed -e 's/^.* into //' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment