Skip to content

Commit 948949a

Browse files
authored
Add a check to verify the base commit build status (#7775)
1 parent d8a2e45 commit 948949a

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

.github/workflows/prepare-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
branch: release/automated_v${{ inputs.version }}
3131
title: Prepare for ${{ inputs.version }}
3232
draft: false
33-
body-path: changes-since-last-tag.txt
33+
body-path: pr-body.txt
3434
labels: no-jira-ticket
3535
commit-message: Prepare for release ${{ inputs.version }}
3636
token: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,4 @@ ssh_agent_commands.sh
110110

111111
# release script artifacts
112112
extracted_changelog.md
113-
changes-since-last-tag.txt
113+
pr-body.txt

tools/release-init.sh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,26 @@ sed -i.bak -e "1s/.*/$RELEASE_HEADER/" "${project_dir}/CHANGELOG.md" || exit 1
5050
sed -i.bak -e "/.*\[#????\](https.*/d" "${project_dir}/CHANGELOG.md"
5151
rm "${project_dir}/CHANGELOG.md.bak" || exit 1
5252

53+
# make the PR description
54+
PR_BODY_FILE="pr-body.txt"
5355
# assumes that tags and history have been fetched
54-
echo "commits since last tag:\n" > changes-since-last-tag.txt
55-
git log $(git describe --tags --abbrev=0)..HEAD --oneline --no-merges >> changes-since-last-tag.txt
56-
echo changes since last tag are
57-
cat changes-since-last-tag.txt
56+
GIT_HASH=$(git rev-parse HEAD)
57+
# if you wish to run this locally you need to install the github cli (https://cli.github.com/manual)
58+
# both the gh and jq are available in github actions natively
59+
GH_STATUS_FOR_COMMIT=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/realm/realm-core/commits/$GIT_HASH/status)
60+
GH_CHECK_STATE=$(echo $GH_STATUS_FOR_COMMIT | jq '.state')
61+
echo "CI checks for $GIT_HASH:" > $PR_BODY_FILE
62+
if [ "$GH_CHECK_STATE" = '"success"' ]; then
63+
echo " succeeded! :white_check_mark:" >> $PR_BODY_FILE
64+
else
65+
echo " failed! :x:" >> $PR_BODY_FILE
66+
fi
67+
echo "You may also want to manually verify the [evergreen checks](https://spruce.mongodb.com/commits/realm-core-stable)" >> $PR_BODY_FILE
68+
echo "" >> $PR_BODY_FILE
69+
echo "commits since last tag:" >> $PR_BODY_FILE
70+
git log $(git describe --tags --abbrev=0)..HEAD --oneline --no-merges >> $PR_BODY_FILE
71+
echo "The PR body file contains:"
72+
cat $PR_BODY_FILE
5873

5974
echo Ready to make "${realm_version}"
6075

0 commit comments

Comments
 (0)