Skip to content

Commit 6e075fc

Browse files
Copilotjeduden
andauthored
Clarify release guard inputs and retry knobs
Agent-Logs-Url: https://github.com/jeduden/mdsmith/sessions/fb2adb55-2bc9-43d4-a062-a549469aa1a3 Co-authored-by: jeduden <1117699+jeduden@users.noreply.github.com>
1 parent 09bd378 commit 6e075fc

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ jobs:
3333
id: decide
3434
env:
3535
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
RELEASE_TAG: ${{ env.VERSION }}
37+
RELEASE_LOOKUP_RETRY_ATTEMPTS: "3"
38+
RELEASE_LOOKUP_RETRY_DELAY_SECONDS: "2"
3639
run: |
3740
if [ "${{ github.event_name }}" != "create" ]; then
3841
echo "should_run=true" >> "$GITHUB_OUTPUT"
@@ -46,7 +49,7 @@ jobs:
4649
exit 0
4750
fi
4851
49-
case "${VERSION}" in
52+
case "${RELEASE_TAG}" in
5053
v*) ;;
5154
*)
5255
echo "should_run=false" >> "$GITHUB_OUTPUT"
@@ -56,7 +59,7 @@ jobs:
5659
esac
5760
5861
status=404
59-
for attempt in 1 2 3; do
62+
for attempt in $(seq 1 "${RELEASE_LOOKUP_RETRY_ATTEMPTS}"); do
6063
status=$(
6164
curl \
6265
--silent \
@@ -67,12 +70,13 @@ jobs:
6770
-H "Accept: application/vnd.github+json" \
6871
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
6972
-H "X-GitHub-Api-Version: 2022-11-28" \
70-
"https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${VERSION}"
73+
"https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/tags/${RELEASE_TAG}"
7174
)
72-
if [ "${status}" != "404" ] || [ "${attempt}" = "3" ]; then
75+
if [ "${status}" != "404" ] || \
76+
[ "${attempt}" = "${RELEASE_LOOKUP_RETRY_ATTEMPTS}" ]; then
7377
break
7478
fi
75-
sleep 2
79+
sleep "${RELEASE_LOOKUP_RETRY_DELAY_SECONDS}"
7680
done
7781
7882
case "${status}" in
@@ -96,7 +100,7 @@ jobs:
96100
exit 0
97101
;;
98102
*)
99-
echo "failed to inspect release for ${VERSION}; api status ${status}" >&2
103+
echo "failed to inspect release for ${RELEASE_TAG}; api status ${status}" >&2
100104
cat /tmp/release.json >&2
101105
exit 1
102106
;;

0 commit comments

Comments
 (0)