-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
"GitHub Allow Mergable Bypass Apply" Broken for Fork PRs #2601
Comments
I think I had the same issue when I tried to use it, but did not identify it was a fork vs branch problem. Now going back looking at the problem PR it was indeed created from a fork. To give more information, when I tried to
not sure if others are seeing the same or a different error message. |
and FYI #2436 is the PR that added this feature. |
I can confirm this issue is happening on the latest version of Atlantis |
pain |
I was also able to reproduce this issue on a fork PR. I am working on a fix and I plan to create a PR. |
You may want to try configuring Repositry Rules instead of fixing this. Make a rule that requires |
If Atlantis requires that the PR is "meragable" then this will not work around the issue. https://www.runatlantis.io/docs/command-requirements.html#mergeable Atlantis may have the power to merge through the check, but it won't. |
I assume the idea would be to remove the In my case this is not an option due to missing Repository Rule feature in the used Github Enterprise version. |
Yes, GitHub Enterprise is a good reason to fix this one :) Just FYI for everyone here, whole bypass-atlantis-apply feature is more of a hack that only works for a specific use case (although pretty common) and only checks whether reviews are correct and status checks are passed. There are many settings in branch protection that are not covered by this feature and that's where Repository Rules should eventually come in play, instead of atlantis re-creating github logic. |
I see- I missed the new https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets feature. The proposal is:
So everyone would be blocked by the rule except Atlantis. |
Yes, and also Repository Rules will eventually replace branch protection entirely, which from the perspective of a default Atlantis flow shouldn't matter, but bypass-atlantis-apply will most probably break. However, I haven't tried the scenario with repository rules, because I'm waiting for GitHub to implement App bypass on the org level. |
I took a crack at this finally and don't think it works (or I am missing something) I create Repository Rule "not-mergable-except-atlantis" But then on a PR, the Atlantis mergable requirement is not met when I try to If I take out "B" then the PR is mergable without apply. @stasostrovskyi any thoughts? == Thanks to @ttretau for fixing this - looking forward to the release 🙏 |
Community Note
Overview of the Issue
--gh-allow-mergeable-bypass-apply
as described here: https://www.runatlantis.io/docs/apply-requirements.html#githubSeems broken for FORK PRs but works fine with BRANCH PRs.
Reproduction Steps
Repo has
atlantis/apply
as a branch protection mergeable requirement. Open up a branch PR and have it work correctly. Open up a Fork PR and see warning and error in the logs (and the PR is not able to be merged until the branch protection is edited).Logs
Logs
The following warning then error come in the logs:
Error
Stacktrace
Warning
Stacktrace
Environment details
Additional Context
I tried figuring out the Go code but I hit
githubPR.GetMergeableState()
which does not seem to be defined anywhere?atlantis/server/events/vcs/github_client.go
Line 382 in 64ce860
The GitHub API it is failing on is https://docs.github.com/en/rest/commits/statuses#get-the-combined-status-for-a-specific-reference
The issue is that the commit ref does not exist in the repository the PR is against, but is coming from the fork.
Thanks
The text was updated successfully, but these errors were encountered: