Project:Emergency Guide for Bypassing Branch Protection Rules

From MaRDI portal
Revision as of 20:18, 18 January 2022 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Recently, GitHub branch protection rules have been introduced to the MaRDI4NFDI. Each feature branch is required to be reviewed by at least one other developer in the project. This is to ensure code-quality and also to transfer knowledge directly at the base of the source-code.

However, there are emergency cases, where a push to the main branch is urgent, and no reviewers are available.

In these cases, the following steps can be taken:

1. Go to settings and then branches in the repository, edit branch rules and add your GitHub-Account id to the list of members who can bypass the branch-protection rules.

(This requires admin-role for the repository, at this point, if you don't have admin role request it by repo-members)

![Screenshot from 2022-01-13 14-39-15](https://user-images.githubusercontent.com/8139033/149341969-d1071b49-f8a1-4e58-a2c7-8cedacd89afd.png)

2. In some cases, even if you are admin, the name is not possible to add to the members. In these cases, at first disable enforce administrators, then add your name like in step one, then enable enforce administrators again. ![Screenshot from 2022-01-13 14-39-25](https://user-images.githubusercontent.com/8139033/149343012-89432c89-4d0c-498f-adf9-0f8d9e154cd6.png)

3. Now go to the PR and make sure all checks have passed and merge conflicts have been resolved. You should now be able to see a checkbox which allows you to directly merge without a review approval. ![Screenshot from 2022-01-13 14-38-12](https://user-images.githubusercontent.com/8139033/149343342-301f344c-a2ed-4f94-af7b-fdab2beb08d8.png)

4. If the PR has been merged, make sure to remove your name from the list of members who can bypass BPR.