Skip to content

Commit 77fc0bb

Browse files
committed
added exit on failed api call
1 parent e7b3436 commit 77fc0bb

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

.github/workflows/release-post-merge.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ jobs:
4747
run: |
4848
TAG_NAME="v$(echo "$PR_TITLE" | awk '{print $2}')"
4949
RELEASE_NOTES=$(cat pr_release_notes.txt)
50-
curl -X POST \
50+
51+
RESPONSE=$(curl -s -o response.json -w "%{http_code}" -X POST \
5152
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
5253
-H "Accept: application/vnd.github.v3+json" \
5354
https://api.github.com/repos/${{ github.repository_owner }}/${{ github.event.repository.name }}/releases \
@@ -56,8 +57,17 @@ jobs:
5657
--arg target_commitish "main" \
5758
--arg name "$TAG_NAME" \
5859
--arg body "$RELEASE_NOTES" \
59-
'{tag_name: $tag_name, target_commitish: $target_commitish, name: $name, body: $body, draft: false, prerelease: false}')"
60-
60+
'{tag_name: $tag_name, target_commitish: $target_commitish, name: $name, body: $body, draft: false, prerelease: false}')")
61+
62+
if [ "$RESPONSE" -ne 201 ]; then
63+
echo "Failed to create GitHub release. Status code: $RESPONSE"
64+
echo "Response body:"
65+
cat response.json
66+
exit 1
67+
else
68+
echo "GitHub release '$TAG_NAME' created successfully."
69+
fi
70+
6171
- name: Merge Main into Develop
6272
run: |
6373
git config user.name "$GITHUB_ACTOR"
@@ -66,7 +76,7 @@ jobs:
6676
git fetch origin main
6777
git merge origin/main
6878
git push origin develop
69-
79+
7080
- name: Update Package Version for Next Development Cycle
7181
run: |
7282
CURRENT_VERSION=$(jq -r '.version' package.json)

0 commit comments

Comments
 (0)