-
-
Notifications
You must be signed in to change notification settings - Fork 93
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
Missing CODEOWNERS fails to merge PR ungracefully #448
Comments
Hmm, this is more than cosmetic, isn't it? If mergify believes it can merge (but Github disagrees due to lack of code owner approval), and strict merges are enabled, mergify will prematurely refresh the branch. (Possibly repeatedly maybe even, I saw that in the past, not sure if that is still a problem.) |
If branch protection is enabled, then Mergify knows the PR is not mergeable so it does not update it. |
Indeed, I was confused by some unrelated hickup. sorry for the noise. |
Actually, no, I think I still see this: The mergify conditions are satisfied, but not all code owners have approved, and now mergify repeatedly updates the branch. |
Maybe there should simply “a can be merged” attribute in https://doc.mergify.io/conditions.html#attributes? Our setup currently has
but really that is just an approximation for the rules that GitHub has already for the branch (must be up-to-date, must have at least one approval, all code owners must have approved, nobody must have requested changes, CI must pass). So wouldn’t it be easiest if I would not have to repeat the rules (incompletely) to mergify? |
This ought to be the default actually. It's unclear to me why CODEOWNERS would not be honored by GitHub API when returning the status of the PR merge-ability. |
Do you use GitHub's mergability to decide whether to update the branch in order to prepare for a strict merge? (I guess not, because if strict merges are required, the PR will be considered unmergeable) |
We can't use GitHub mergeability state for this because it's bugged. We reached GitHub support multiple times on this, but they failed to fix it. The API provides a correct value 95% of the time, but in some cases, it is not outdated and shows something different than what the user sees in the UI (!). That's why the engine ignores the field and tries to merge if the conditions are valid. It might try the merge (and therefore updating/rebasing the PR) even if it's obvious for a human that the CODEOWNER file is going to block the merger. Since GitHub is not able to provide a correct field for the engine, that means it'd need to implement all the branch protection features itself with the same logic to compute the mergeability state itself. It does not do that yet, mainly because it's a huge piece of work to do and to get right, and also because we so far hoped for GitHub to fix the issue. |
Thanks for the update Julien! Since any CODEOWNER (person or team) is automatically requested for review by GitHub we're considering adding the Mergify condition:
to approximate the CODEOWNERS logic. |
I woner if
|
Also, our internal testing shows that |
I'm getting a |
Would be a good idea but you can't use variables in the right part of an expression. :(
The problem with This is noted here if you're curious: https://github.com/Mergifyio/mergify-engine/blob/master/mergify_engine/actions/merge/helpers.py#L52-L58 |
Hmm, I don’t think that’s what I mean. I expect that we get |
@nomeata oh yeah, definitely. That's another issue indeed. |
Is there any hope in a fix for this? Maybe reimplement CODEOWNERS logic externally? This is constantly adding friction here… |
Not for now. We're tracking this on our roadmap. I think it'd be great to have an alternative to Do you have any idea of what would be the perfect workflow for you with Mergify if you had to replace CODEOWNERS, @nomeata ? |
is this CODEOWNERS resolved, I found that some other bots have explicitly set how many code-owners has to approve |
It's solved for branch protections, as in Mergify now move back the PR at the end of the queue if it can't be merged because of code owners not matching. So it works, it's not optimized as Mergify can't get the protection status to know if it's worth putting the PR into the queue or not. |
On a PR that had been approved, but not by codeowners we get the error message:
Branch protection settings are blocking automatic merging See: https://doc.mergify.io/faq.html#mergify-is-unable-to-merge-my-pull-request-due-to-my-branch-protection-settings
GitHub error message: Waiting on code owner review from ...
This is pretty misleading because it looks like mergify is broken, but it is actually expected that it isn't merged.
Is it possible for mergify to expect codeowners approval?
Note - this is pretty much a cosmetic issue only
The text was updated successfully, but these errors were encountered: