Skip to content
Latchkey

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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →