Skip to content

[FEATURE] Bounded retry for transient GitHub API failures (default: single attempt) #20

Closed

Description

@c-vigo

Description

Add optional, bounded retries around GitHub REST calls used to resolve and update refs (and other operations prone to flakes), so consumers do not need workflow-level workarounds. Default behavior must remain a single attempt (no retries unless configured).

Problem Statement

Downstream workflows (e.g. smoke-test deploy) sometimes fail inside this action with transient GitHub API errors such as 404 on get a reference shortly after the branch ref was created or updated. A later run with the same inputs often succeeds. Callers today must duplicate retry/re-mint logic in YAML or re-run entire jobs.

Proposed Solution

  • Introduce a single, explicit configuration for how many times the action may attempt the ref/git API sequence (name TBD, e.g. MAX_ATTEMPTS or API_RETRY_ATTEMPTS), with default 1 = current behavior (one try, no retry loop).
  • When > 1, retry only on a narrow, documented set of transient conditions (e.g. HTTP 404 on ref get shortly after create, 5xx, rate limit / secondary rate limit responses), with bounded backoff and a hard cap on attempts.
  • Surface clear logs: attempt number, error classification, backoff delay.
  • Document semantics in the action README (what counts as an attempt, which errors retry, compatibility).

Alternatives Considered

  • Retry only in consumer workflows — works but duplicates YAML, cannot centralize classification/backoff, and mixes concerns with token minting (only workflows can re-mint app tokens).
  • Unbounded or implicit retries — rejected; must stay bounded and opt-in beyond default single attempt.

Additional Context

Impact

  • Beneficiaries: All workflows using vig-os/commit-action (release automation, smoke-test deploy, etc.).
  • Compatibility: Backward compatible if default remains one attempt.
  • Not a breaking change if defaults preserve current behavior.

Changelog category: Added (user-visible behavior when opt-in retries are enabled)

  • TDD compliance (see .cursor/rules/tdd.mdc in consuming repos; add/adapt tests in this repo as appropriate)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions