Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix GitHub pull request mergeability for rerun checks #5051

Closed

Conversation

ajax-ryzhyi-r
Copy link
Contributor

what

This PR modifies the evaluation logic for statusContexts and checkRuns by iterating from the end of the arrays instead of the beginning.

why

There is an issue described in detail in #5048 where Atlantis still treats a PR as unmergeable after successfully rerunning failed required checks. It responds with the error Apply Failed: Pull request must be mergeable before running apply. when attempting to use the atlantis apply command.

Upon investigating this issue, I discovered that GitHub returns all statusContexts/checkRuns in chronological order when Atlantis retrieves a pull request's last commit mergeability status. However, Atlantis iterates through these statusContexts/checkRuns and retrieves the first statusContext/checkRun instead of the last one, which represents the current status.

tests

  • I have tested my changes by running this fix in our Atlantis setup and everything works as expected
  • I have updated automated tests to cover these cases

references

Fixes #5048

@ajax-ryzhyi-r ajax-ryzhyi-r requested review from a team as code owners November 2, 2024 19:21
@ajax-ryzhyi-r ajax-ryzhyi-r requested review from chenrui333, lukemassa and nitrocode and removed request for a team November 2, 2024 19:21
@github-actions github-actions bot added go Pull requests that update Go code provider/github labels Nov 2, 2024
@dosubot dosubot bot added the bug Something isn't working label Nov 2, 2024
@ajax-ryzhyi-r ajax-ryzhyi-r changed the title Fix GitHub pull request mergeability for rerun checks fix: Fix GitHub pull request mergeability for rerun checks Nov 2, 2024
@github-actions github-actions bot added build Relating to how we build Atlantis docs Documentation dependencies PRs that update a dependency file github-actions labels Nov 3, 2024
@ajax-ryzhyi-r ajax-ryzhyi-r force-pushed the github-mergeability-fix branch 2 times, most recently from 53ae7d2 to 325dda2 Compare November 3, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working build Relating to how we build Atlantis dependencies PRs that update a dependency file docs Documentation github-actions go Pull requests that update Go code provider/github
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unclearable locks with mergeability requirements after upgrade
2 participants