rust-lang / team

Rust teams structure
Apache License 2.0
306 stars 281 forks source link

Add the option to not require a PR for protected branches #1359

Open Kobzol opened 4 months ago

Kobzol commented 4 months ago

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:

Kobzol commented 3 months ago

The sync-team side of this change is here.