Skip to content

Commit 0c2da16

Browse files
committed
capture errors
1 parent 83de4c0 commit 0c2da16

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

.github/workflows/create-release.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,17 @@ jobs:
2020
env:
2121
GH_TOKEN: ${{ github.token }}
2222
run: |
23-
echo "::group::Output PR # and labels"
2423
LAST_PR_NUMBER=$(gh pr list --state merged --json number --jq '.[0].number')
2524
LABELS=$(gh pr view "$LAST_PR_NUMBER" --json labels --jq '.labels[].name')
2625
echo "::notice::PR used to check version bump: #$LAST_PR_NUMBER"
2726
echo "::notice::PR labels: "[${LABELS//$'\n'/,}]""
28-
echo "::endgroup::"
2927
30-
RELEASE_TYPE=$(./.github/ci-scripts/pr-label-check.sh)
28+
RELEASE_TYPE=$(./.github/ci-scripts/pr-label-check.sh) || exit_code=$?
29+
if [ "$exit_code" -ne 0 ]; then
30+
echo "::error::PR #"$LAST_PR_NUMBER" has more than one release label"
31+
exit $exit_code
32+
fi
33+
3134
echo "version=$RELEASE_TYPE" >> $GITHUB_OUTPUT
3235
echo "::group::Output version"
3336
echo "::notice::Release type: $RELEASE_TYPE"
@@ -54,8 +57,9 @@ jobs:
5457
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5558
run: |
5659
VERSION=$(node -p "require('./package.json').version")
57-
gh release create "v${VERSION}" \
58-
--title "Release v${VERSION}" \
59-
--generate-notes \
60-
--prerelease \
61-
--target "${COMMIT_SHA}"
60+
echo "Would execute command:"
61+
echo "gh release create \"v${VERSION}\" \\"
62+
echo " --title \"Release v${VERSION}\" \\"
63+
echo " --generate-notes \\"
64+
echo " --prerelease \\"
65+
echo " --target \"${COMMIT_SHA}\""

0 commit comments

Comments
 (0)