Content-Length: 323342 | pFad | https://github.com/python-gitlab/python-gitlab/discussions/3225#discussioncomment-13597753

BA how can I specify the branches for a merge request approval rule? · python-gitlab python-gitlab · Discussion #3225 · GitHub
Skip to content
Discussion options

You must be logged in to vote

I found a solution

project = gl.projects.get("my-project")
main_branch = project.protectedbranches.get("main")
project.approvalrules.create(
                {
                    "name": rule_name,
                    "approvals_required": 1,
                    "rule_type": "regular",
                    "protected_branch_ids": [main_branch_id.id],
                    "group_ids": approver_group_ids,
                }
            )

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by guerda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/python-gitlab/python-gitlab/discussions/3225#discussioncomment-13597753

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy