You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
autoupdater: fix: updating branch failed because wrong ExpectedHeadSHA
Sometimes updating a PR with the base branch failed with the error message:
"evaluating if PR is uptodate with base branch failed: context deadline
exceeded"
where the individual update operation tries failed with
- "retryable error: PUT https://api.github.com/repos/[..]/update-branch:
422 expected head sha didn’t match current head ref."
When a PR branch was not up to date with the base branch, and the GitHub Pull Request
API endpoint did not return "behind", BranchIsBehindBase() was called. The
function queries the GitHub Compare Commit endpoint to figure out if the branch
needs to be updated.
The returned HEAD commit of BranchIsBehindBase() was then used as
ExpectedHeadSHA parameter for the UpdateBranch operation.
The HEAD SHA returned by BranchIsBehindBase() was the SHA of the first commit
in the branch instead of HEAD.
This caused that UpdateBranch() was retried with a wrong ExpectedHeadSHA and
failed until the retry timeout was exceeded.
Do not return from BranchIsBehindBase() the branch HEAD SHA anymore, we would
have to handle pagination to get the HEAD SHA.
Use the HEAD SHA that was retrieved by the GitHub Pull-Request endpoint instead
in PRIsUptodate().
0 commit comments