What Is GITHUB_RUN_ATTEMPT?
GITHUB_RUN_ATTEMPT is the attempt number for the current run, starting at 1 and incrementing on each re-run.
GITHUB_RUN_ATTEMPT lets a workflow detect that it is a re-run, which is handy for retry-aware caching or messaging.
Example
Detect a manual re-run.
yaml
if: ${{ github.run_attempt > 1 }}Reliability note
Manual re-runs cost you the wasted minutes of the first attempt. Self-healing managed runners like Latchkey automatically retry genuinely transient failures (network blips, OOM-kills) so a re-run is often unnecessary.
Key takeaways
- GITHUB_RUN_ATTEMPT starts at 1 and grows per re-run.
- Detect re-runs in workflow logic.
- Auto-retrying runners cut manual re-runs.
Related guides
What Is GITHUB_RUN_ID?GITHUB_RUN_ID is the unique identifier for a GitHub Actions workflow run. Learn how to use it for logs, artif…
What Is Self-Healing CI? ExplainedSelf-healing CI automatically detects and recovers from transient and mechanical failures so a one-off blip d…
What Is an Automatic Retry? ExplainedAn automatic retry re-runs a failed operation without human intervention. Learn when retries help, when they…