Skip to content
Latchkey

How to Retry a Failed Step or Job in GitHub Actions

GitHub has no built-in step retry. Here are the real options - from manual re-runs to fully automatic self-healing.

Transient failures (network blips, registry timeouts, flaky tests) fail a run that would pass on a second try. GitHub Actions has no native per-step retry, so teams reach for one of these approaches.

Manual re-run

The "Re-run failed jobs" button works but is reactive, slow, and costs you the wasted minutes of the first attempt. It does not scale.

Retry action with backoff

Wrap a flaky step with a retry action so it re-attempts automatically a few times before failing.

.github/workflows/ci.yml
- name: Tests (with retry)
  uses: nick-fields/retry@v3
  with:
    max_attempts: 3
    timeout_minutes: 10
    command: npm test

Shell-level retry

For a single command, a small bash loop with backoff (for i in 1 2 3; do cmd && break; sleep 5; done) handles transient network calls.

Automatic self-healing (no config)

The cleanest option is runners that detect transient and mechanical failures and retry them automatically - no per-step retry config, and no paying for manual re-runs. That is what Latchkey does: OOM kills, disk-full, registry timeouts, and other transient failures are recovered without a human, while real code failures still surface.

Key takeaways

  • GitHub has no native step retry.
  • Retry actions/bash loops work but need per-step config.
  • Self-healing runners retry transient failures automatically and surface real ones.

Frequently asked questions

Can I retry a whole job automatically?
Not natively. You can re-run failed jobs manually, script retries per step, or use self-healing runners that retry transient failures for you.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →