wayfair-incubator / telefonistka

Safe and Controlled GitOps Promotion Across Environments/Failure-Domains
https://hub.docker.com/r/odedbenozer/telefonistka
MIT License
63 stars 7 forks source link

Automerge fails on some PRs when there are multiple PRs being merged in very short period of time #176

Closed Ben10k closed 5 months ago

Ben10k commented 5 months ago

Description

Sometimes GitHub rejects the api call to merge the PR.

Expected Behaviour

Failed PR should be retried a few (configurable) times with (preferably) an exponential delay. Failure could still be logged as a warning

Actual Behaviour

Leaves the PR open and logs this message:

time="2024-05-14T15:32:53Z" level=error msg="Failed to merge PR: err=PUT https://api.github.com/repos/[REPO_OWNER]/[REPO_NAME]/pulls/4333/merge: 405 Base branch was modified. Review and try the merge again. []" prNumber=4331 repo=[REPO_OWNER]/[REPO_NAME]

Affected Version

v0.1.9

Steps to Reproduce

Run telefonistka bump-regex --auto-merge ... in a loop on the same repository.

Checklist

Oded-B commented 5 months ago

Sounds good. I think we should only retry on 405s (and 5XX?), the rest doesn't seem relevant: https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#merge-a-pull-request

Ben10k commented 5 months ago

I agree. I'll start working on it in the upcoming weeks