Is there a status API equivalent for PRs? #21889
-
As far as I know, I can prevent a PR from merging by having conflicts, by not satisfying review obligations, or by marking the commit as bad with the status API. How can I prevent a PR from merging for custom reasons that are independent of the underlying commit? e.g. maybe I want to prevent merging of any PRs that are based on branches that are themselves open for review (since that can cause double-review of the same code). Is there any way of enforcing that these PRs don’t get merged? The closest thing I can see right now is to add a bot as a reviewer, and try to adjust review obligations such that no PR can merge without that bot’s approval, regardless of who else has done review. I’m not even sure that that’s possible. Any ideas? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Check out the Work in Progress Probot app for an example of such a bot. You would have to code whatever logic you want for determining whether a PR should be allowed to merge but the bot then posts an entry via the Status API. |
Beta Was this translation helpful? Give feedback.
-
Thanks! I originally didn’t want to use the status API to track things that are related to PR state and not commit state (e.g. the review state of the PR, whether work items have been resolved, etc.) because the status is tied to the commit and not the PR. It also means that when new commits are pushed, I need to duplicate the status from the old commits onto the new ones even if the PR is otherwise unchanged. But it sounds like there aren’t other options, so I’m using the status API now and it’s working fine. It means a small extra assumption that any commit is in at most one PR (since otherwise you’d be sharing/clobbering state between PRs via the commit status), but so far that’s been a reasonable assumption. Thanks! |
Beta Was this translation helpful? Give feedback.
Check out the Work in Progress Probot app for an example of such a bot. You would have to code whatever logic you want for determining whether a PR should be allowed to merge but the bot then posts an entry via the Status API.