This PR adds a pr-required = <true/false> option to branch protections. There are some repositories that use branch protections, but that do not require a PR.
I also refactored the branch protection mode to make the data representation clearer/make it impossible to represent invalid states (such as PR not required, but a required approval count is set). This is a compatibility break for the v1 data format, but branch protections are only read by sync-team anyway, so it shouldn't be a big deal.
An interesting thing is that it does not actually make sense to require any CI status checks if a PR is not required, because we do not enable anyone to bypass the branch protections. Because if you set a CI check, and try to push to the branch without a PR, it will be rejected.
Without a required PR, the branch protection still disallows force pushes and deletion, and allows us to set push actor allowances.
This PR adds a
pr-required = <true/false>
option to branch protections. There are some repositories that use branch protections, but that do not require a PR.I also refactored the branch protection mode to make the data representation clearer/make it impossible to represent invalid states (such as PR not required, but a required approval count is set). This is a compatibility break for the v1 data format, but branch protections are only read by
sync-team
anyway, so it shouldn't be a big deal.An interesting thing is that it does not actually make sense to require any CI status checks if a PR is not required, because we do not enable anyone to bypass the branch protections. Because if you set a CI check, and try to push to the branch without a PR, it will be rejected.
Without a required PR, the branch protection still disallows force pushes and deletion, and allows us to set push actor allowances.
Relevant repos: