Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3701

Update branch protection REST api issue for "Specify who can force push"

$
0
0

In GitHub REST API (using curl) I'd like to update the branch protection's "Specify who can force push" portion.image

Which JSON property in the PUT body below is for "Specify who can force push" from the screenshot above?https://docs.github.com/en/enterprise-server@3.12/rest/branches/branch-protection?apiVersion=2022-11-28#update-branch-protection

It seems this functionality was added in the GitHub UI relatively recently, but the REST api and/or docs, perhaps, were not updated.See https://github.blog/changelog/2021-12-21-specify-who-can-force-push-to-a-repository/

curl -L \  -X PUT \  -H "Accept: application/vnd.github+json" \  -H "Authorization: Bearer <YOUR-TOKEN>" \  -H "X-GitHub-Api-Version: 2022-11-28" \  http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/branches/BRANCH/protection \  -d ...
// sample json from doc{"required_status_checks": {"strict": true,"contexts": ["continuous-integration/travis-ci"    ]  },"enforce_admins": true,"required_pull_request_reviews": {"dismissal_restrictions": {"users": ["octocat"      ],"teams": ["justice-league"      ]    },"dismiss_stale_reviews": true,"require_code_owner_reviews": true,"required_approving_review_count": 2,"require_last_push_approval": true,"bypass_pull_request_allowances": {"users": ["octocat"      ],"teams": ["justice-league"      ]    }  },"restrictions": {"users": ["octocat"    ],"teams": ["justice-league"    ],"apps": ["super-ci"    ]  },"required_linear_history": true,"allow_force_pushes": true, // this corresponds to "Allow force pushes" setting in GitHub UI/portal  // question: which json property is for "Specify who can force push" setting in GitHub UI/portal?"allow_deletions": true,"block_creations": true,"required_conversation_resolution": true,"lock_branch": true,"allow_fork_syncing": true}

Versions used:

GitHub Enterprise Server 3.12.4REST api, using cURL


Viewing all articles
Browse latest Browse all 3701

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>