My team is going through all of our repos and adding branch protection rules. This is something that can be manually configured by checking some boxes, as described here:
Even though this is exactly what we are looking for, going through and selecting a matrix of checkboxes for our many dozen repositories is not how we would like to work. Instead we are looking to streamline the process by using a configuration file inside the project.
We are specifically interested in the following:
- Requiring pull request reviews before merging
- Requiring status checks before merging
- Requiring conversation resolution before merging
We do have one problem, we don't want it to be something that requires organizational approval, since it will most likely get rejected. That means using the GitHub REST api, the GitHub Actions or GitHub Apps won't work for us.
Is there any way to provide this functionality without organizational approval, but using a Git Hook or something like that?
I see that this stack overflow question has a way to prevent commits in the master branch using a git hook. Is there any way to use a git hook to perform the functionality above?