wayfair-incubator/telefonistka

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

Ben10k opened this issue · 2 comments

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

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

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