Skip to content

Commit 9721c79

Browse files
eviosclaude
andcommitted
add auto-retry on failure (up to 3 attempts) to daily and weekly workflows
Re-runs only failed jobs via GitHub API. Handles transient infrastructure errors like the internal server error on 2026-03-20. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c5ce325 commit 9721c79

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

.github/workflows/generate-digest-daily.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ concurrency:
3030

3131
permissions:
3232
contents: read
33+
actions: write # Required for auto-retry
3334
id-token: write # Required for Claude Code Action OIDC
3435

3536
env:
@@ -205,3 +206,16 @@ jobs:
205206
python agent/integrations/substack/substack.py --post \
206207
--start-date "${{ github.event.inputs.start_date }}" \
207208
--end-date "${{ github.event.inputs.end_date }}"
209+
210+
# --- Auto-retry on failure (up to 3 attempts) ---
211+
retry:
212+
needs: [generate-messenger, generate-blog, publish-telegram, publish-ghost, publish-substack]
213+
if: always() && failure() && fromJSON(github.run_attempt) < 3
214+
runs-on: ubuntu-latest
215+
steps:
216+
- name: Retry failed jobs
217+
env:
218+
GH_TOKEN: ${{ github.token }}
219+
run: |
220+
echo "Attempt ${{ github.run_attempt }} failed -- retrying..."
221+
gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/rerun-failed-jobs -X POST

.github/workflows/generate-digest-weekly.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ concurrency:
3030

3131
permissions:
3232
contents: read
33+
actions: write # Required for auto-retry
3334
id-token: write # Required for Claude Code Action OIDC
3435

3536
env:
@@ -211,3 +212,16 @@ jobs:
211212
pip install -r agent/integrations/substack/requirements.txt
212213
python agent/integrations/substack/substack.py --post \
213214
--start-date "$START_DATE" --end-date "$END_DATE"
215+
216+
# --- Auto-retry on failure (up to 3 attempts) ---
217+
retry:
218+
needs: [generate-messenger, generate-blog, publish-telegram, publish-ghost, publish-substack]
219+
if: always() && failure() && fromJSON(github.run_attempt) < 3
220+
runs-on: ubuntu-latest
221+
steps:
222+
- name: Retry failed jobs
223+
env:
224+
GH_TOKEN: ${{ github.token }}
225+
run: |
226+
echo "Attempt ${{ github.run_attempt }} failed -- retrying..."
227+
gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/rerun-failed-jobs -X POST

0 commit comments

Comments
 (0)