Map 'Require pull request before merging' GitHub rule with access_levels
What does this MR do and why?
It solves Require a pull request before merging
Screenshots or screen recordings
map-require-pr-before-merging-with-access_levels
How to set up and validate locally
Scenario 1:
- On GitHub create a protection rule with "Require a pull request before merging" enabled for any branch
- Import the project from GitHub to GitLab
- Go to project -> Settings -> Repository -> expand Protected branches section
- Ensure the same branch is protected on GitLab with such setting:
-
Allowed to push-No one
Protected branch is the default branch:
Scenario 2:
- On GitLab go to Admin Area -> Settings -> Repository -> Default branch -> enable Partially protected -> Save changes
- On GitHub create a protection rule with any enabled options except "Require a pull request before merging" for default branch
- Import the project from GitHub to GitLab
- Go to project -> Settings -> Repository -> expand Protected branches section
- Ensure the default branch is protected with such setting:
-
Allowed to push-Developers + Maintainers -
Allowed to merge-Maintainers
Scenario 3:
- On GitLab go to Admin Area -> Settings -> Repository -> Default branch -> enable any option (e.g.
Protected against pushes) exceptPartially protected-> Save changes 2-4. the same as in Scenario 2 - Ensure the default branch is protected with such setting:
-
Allowed to push-Maintainers -
Allowed to merge-Developers + Maintainers(if in p.1Protected against pusheswas chosen) orMaintainers(if in p.1Not protectedorFully protectedwas chosen)
Protected branch is also protected on GitLab: (scenarios 4-7 cannot be validated until Group-level protected branches MVC is implemented)
Scenario 4:
- On GitHub create a protection rule with any enabled options except "Require a pull request before merging" for non-default branch (e.g. staging)
- On GitLab go to some group's Settings -> Repository -> Protected branches -> create protected rule for the staging branch with such setting:
Allowed to push-No one(orDevelopers + Maintainers, orMaintainers) - Import the project from GitHub to GitLab to the group from p.2
- Go to project -> Settings -> Repository -> expand Protected branches section
- Ensure the staging branch is protected with such setting:
-
Allowed to push-No one(orDevelopers + Maintainers, orMaintainers) (the same as in p.2)
Scenario 5:
- the same as in Scenario 4
- On GitLab go to some group's Settings -> Repository -> Protected branches -> create protected rule for the staging branch with such setting:
Allowed to push- choose any user - the same as in Scenario 4
- the same as in Scenario 4
- Ensure the staging branch is protected with such setting:
-
Allowed to push-Maintainers
Scenario 6:
- the same as in Scenario 4
- On GitLab go to some group's Settings -> Repository -> Protected branches -> create protected rule for the staging branch with such setting:
Allowed to merge-No one - the same as in Scenario 4
- the same as in Scenario 4
- Ensure the staging branch is protected with such setting:
-
Allowed to merge-No one
Scenario 7:
- the same as in Scenario 4
- On GitLab go to some group's Settings -> Repository -> Protected branches -> create protected rule for the staging branch with such setting:
Allowed to merge-Developers + Maintainers(orMaintainers) - the same as in Scenario 4
- the same as in Scenario 4
- Ensure the staging branch is protected with such setting:
-
Allowed to merge-Developers + Maintainers(orMaintainers) (the same as in p.2)
Protected branch is neither default nor protected on GitLab:
Scenario 8:
- On GitHub create a protection rule with any enabled options except "Require a pull request before merging" for non-default branch (e.g. staging)
- Import the project from GitHub to GitLab
- Go to project -> Settings -> Repository -> expand Protected branches section
- Ensure the staging branch is protected with such settings:
-
Allowed to push-Maintainers -
Allowed to merge-Maintainers
MR acceptance checklist
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Tetiana Zavediuk