Skip to content

GH API to update branch permissions #24758

Discussion options

You must be logged in to vote

This post helped me answer my question. So, I had to pass in the array object as input as opposed to the field value (as that cannot take array values currently)

Something like this worked for me:

jq -n '{"required_status_checks":{"strict":true,"contexts":["contexts"]},"enforce_admins":true,"required_pull_request_reviews": {},"restrictions":{"users":["users"],"teams":["teams"],"apps":["apps"]}}' | gh api -X PUT repos/<orgName>/<repoName>/branches/main/protection --input -

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment