Skip to content

Commit 9a8511a

Browse files
authored
Merge pull request #5040 from zainasir/jitpack-action
add retry logic for 404 errors
2 parents 1081908 + 3dff871 commit 9a8511a

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

.github/workflows/jitpack-build.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,29 @@ jobs:
1717

1818
- name: Get release tag
1919
id: get_tag
20-
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
20+
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
2121

2222
- name: Trigger JitPack Build
2323
run: |
2424
TAG=${{ steps.get_tag.outputs.tag }}
2525
JITPACK_BUILD_URL="https://jitpack.io/com/github/cbioportal/cbioportal-frontend/$TAG/build.log"
26-
echo "Triggering JitPack build for $TAG"
27-
curl -I $JITPACK_BUILD_URL
28-
29-
- name: Notify success
30-
run: echo "JitPack build triggered successfully."
26+
27+
MAX_RETRIES=10
28+
RETRY_DELAY=30
29+
COUNTER=0
30+
31+
while [ $COUNTER -lt $MAX_RETRIES ]; do
32+
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST "$JITPACK_BUILD_URL")
33+
34+
if [ "$HTTP_STATUS" -eq 200 ]; then
35+
echo "Build triggered successfully for version ${TAG}."
36+
exit 0
37+
else
38+
echo "Attempt $((COUNTER+1)) failed with status $HTTP_STATUS: Tag not found yet. Retrying in $RETRY_DELAY seconds..."
39+
((COUNTER++))
40+
sleep $RETRY_DELAY
41+
fi
42+
done
43+
44+
echo "Failed to trigger JitPack build after $MAX_RETRIES attempts."
45+
exit 1

0 commit comments

Comments
 (0)