Skip to content

Retry on non-fast-forward instead of falling back to createRef - #603

Open
mersman wants to merge 1 commit into
fjogeleit:mainfrom
Ibotta:retry-on-non-fast-forward
Open

mersman wants to merge 1 commit into
fjogeleit:mainfrom
Ibotta:retry-on-non-fast-forward

Conversation

@mersman

@mersman mersman commented Oct 29, 2026

Copy link
Copy Markdown

Fixes the failure from #533. When another commit lands on the branch while the action is committing, updateRef fails with Update is not a fast forward, and the fallback to createRef then fails with Reference already exists. We hit this regularly when several services update image tags in the same deployment repo at once. In #533 you mentioned there was no way to update the branch via the SDK; this rebuilds the commit on the new branch head and retries instead.

  • A non-fast-forward rejection now rebuilds the commit on the new head and retries, up to retries times (new input, default 3, 0 disables). Other updateRef errors still fall back to createRef.
  • Before committing, the action checks whether any of the files it's updating changed on the branch since the commit they were read from. If so, it fails instead of overwriting them. This applies even with retries: 0.
  • The commit output is only set once the branch update succeeds.

Tests are in __tests__/git-processing.test.ts, and dist/ is rebuilt. Happy to default retries to 0 if you'd rather keep it opt-in.

When another commit lands on the branch while the action is committing,
rebuild the commit on the new head and retry (new `retries` input,
default 3). Fail instead of overwriting files that changed on the branch
since the commit they were read from, and only set the `commit` output
once the branch update succeeds.

Refs fjogeleit#533
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant