Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
githubclt: check mergeable_state field when evaluating if a PR is upt…
…odate The githubclt.PRIsUptodate() can return the wrong result (#28). It evaluates if a PR is uptodate with the base branch via information from the github REST pulls API. It compares the base.sha field of the PR message with the HEAD SHA that is retrieved for the base branch. The base.sha returned from the pulls API is the SHA of the base-branch from when the PR was created. It is not related to the commits in the PR branch, it is not the most recent ancestor of both branches. That means if e.g. a PR is created with a branch based on commit main-HEAD^, the base.sha in the pulls message will be main-HEAD instead. The Check will return that the PR is uptodate despite it is not. To improve the behavior PRIsUptodate() now also checks if the mergeable_state has the value "behind", which means that the branch is not update. This does not fix the issue, it only makes it a bit more unlikely to occur. mergeable_state can have another value like UNSTABLE and the PR might be outofdate.
- Loading branch information