scripts: account for master branch merges in release notes script

Without this commit, the build may break if a PR commit is created, as
that shows the `PR_NUMBER` field we parse out as "master", reflecting
that its a merge commit into the master branch.
This commit is contained in:
Olaoluwa Osuntokun 2021-07-19 15:28:17 -07:00
parent 7176a212f7
commit fee92941f1
No known key found for this signature in database
GPG Key ID: 3BBD59E99B280306

@ -6,6 +6,13 @@ set -e
# format of the string stored in the variable is: refs/pull/:PRNUMBER/merge. # format of the string stored in the variable is: refs/pull/:PRNUMBER/merge.
PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }') PR_NUMBER=$(echo $GITHUB_REF | awk 'BEGIN { FS = "/" } ; { print $3 }')
# If this is a PR being merged into the main repo, then the PR number will
# actually be "master" here, so we'll ignore this case, and assume that in
# order for it to be merged it had to pass the check in its base branch.
if [ $PR_NUMBER == "master" ]; then
exit 0
fi
# Ensure that the PR number at least shows up in the release notes folder under # Ensure that the PR number at least shows up in the release notes folder under
# one of the contained milestones. # one of the contained milestones.
if ! grep -r -q "lightningnetwork/lnd/pull/$PR_NUMBER" docs/release-notes; then if ! grep -r -q "lightningnetwork/lnd/pull/$PR_NUMBER" docs/release-notes; then