Skip to content

Commit c89d807

Browse files
authored
Merge pull request #101 from DataRecce/fix/deploy-retry-on-transient-failure
ci(deploy): retry gh-deploy on transient GitHub 500
2 parents b3fed22 + b3daebd commit c89d807

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,27 @@ jobs:
2525
path: .cache
2626
restore-keys: |
2727
mkdocs-material-
28-
- run: pip install -r requirements.txt
29-
- run: mkdocs gh-deploy --force
30-
28+
- run: pip install -r requirements.txt
29+
# gh-deploy occasionally hits a transient HTTP 500 from GitHub on the
30+
# push to gh-pages (see run 25674953089). Retry a few times before
31+
# failing the job so a one-off blip doesn't take docs.reccehq.com down.
32+
- name: Deploy to gh-pages (with retry)
33+
env:
34+
DISABLE_MKDOCS_2_WARNING: "true"
35+
run: |
36+
set -e
37+
attempts=3
38+
delay=15
39+
for i in $(seq 1 "$attempts"); do
40+
if mkdocs gh-deploy --force; then
41+
echo "Deploy succeeded on attempt $i"
42+
exit 0
43+
fi
44+
if [ "$i" -lt "$attempts" ]; then
45+
echo "Deploy attempt $i failed; retrying in ${delay}s..."
46+
sleep "$delay"
47+
delay=$((delay * 2))
48+
fi
49+
done
50+
echo "Deploy failed after $attempts attempts"
51+
exit 1

0 commit comments

Comments
 (0)