Skip to content
Latchkey

nick-fields/retry: Retry Flaky Steps in CI

retry re-runs a command with timeouts and attempt limits to ride out transient failures.

Wrap a flaky command (a network call, an occasionally-failing test) so a single blip does not fail the whole job. Configure attempts, per-attempt timeout, and retry conditions.

Key inputs (with:)

  • command: the command to run and retry (required).
  • max_attempts: how many tries.
  • timeout_minutes / timeout_seconds: per-attempt timeout.
  • retry_wait_seconds: delay between attempts.
  • retry_on: error, timeout, or any.

Example workflow

.github/workflows/ci.yml
jobs:
  e2e:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: nick-fields/retry@v3
        with:
          max_attempts: 3
          timeout_minutes: 10
          retry_wait_seconds: 15
          command: npm run test:e2e

Retries vs self-healing

Retry helps with flaky commands. For flaky infrastructure (a runner that hangs or dies mid-job), Latchkey managed runners self-heal at the runner level so you retry less.

Key takeaways

  • Set a per-attempt timeout so a hung try does not stall forever.
  • Use retry_on to retry only on the failures you expect.
  • Reserve retries for genuinely transient steps.

Related guides

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