Skip to content
Latchkey

How to Retry a Flaky Script in GitHub Actions

A retry action re-runs a flaky script a few times with backoff before giving up, absorbing transient hiccups.

Wrap the command in nick-fields/retry, setting attempt count, per-attempt timeout, and wait. Reserve retries for genuinely transient failures, not real bugs.

Steps

  • Replace the brittle run: with the retry action.
  • Set max_attempts, timeout_minutes, and command.
  • Log attempts so you can find and fix the root cause later.

Workflow

.github/workflows/ci.yml
steps:
  - uses: nick-fields/retry@v3
    with:
      max_attempts: 3
      timeout_minutes: 10
      retry_wait_seconds: 15
      command: ./scripts/integration-test.sh

Gotchas

  • Retrying masks flakiness; track which scripts retry so you can fix the underlying cause.
  • Latchkey managed runners auto-retry transient infrastructure failures, so retries can focus on your own flaky steps.

Related guides

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