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:e2eRetries 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
actions/checkout: Inputs & Workflow UsageReference for actions/checkout: clone your repository into the runner, control fetch-depth, submodules, refs,…
dorny/paths-filter: Conditional Jobs by Changed PathsReference for dorny/paths-filter: detect which paths changed in a push or PR and gate downstream jobs or step…
slackapi/slack-github-action: Send Slack NotificationsReference for slackapi/slack-github-action: post build status to Slack via a webhook or the Web API, with pay…