Description Usage Arguments Value Examples
Branch Protection
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | protect_branch(branch = "master", overwrite = FALSE,
required_approving_review_count = 1, required_linear_history = FALSE,
allow_force_pushes = FALSE, allow_deletions = FALSE,
enforce_admins = TRUE, repo_spec = github_repo_spec(),
auth_token = github_token(), host = NULL)
get_branch_protection(branch = "master", return_type = c("exists",
"verbose"), repo_spec = github_repo_spec(),
auth_token = github_token(), host = NULL)
is_master_protected(repo_spec = github_repo_spec(),
auth_token = github_token(), host = NULL)
protect_master(required_approving_review_count = 1, overwrite = TRUE,
required_linear_history = TRUE, allow_force_pushes = FALSE,
allow_deletions = FALSE, enforce_admins = TRUE,
repo_spec = github_repo_spec(), auth_token = github_token(),
host = NULL)
|
branch |
Branch in your project. Defaults to 'master' |
overwrite |
Whether to overwrite existing protections if they exist |
required_approving_review_count |
Number of required approving reviews on a pull request before merging. If <1 or 'NA', no requirement |
required_linear_history |
Enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch. Default false. For more information see [docs](https://help.github.com/github/administering-a-repository/requiring-a-linear-commit-history) |
allow_force_pushes |
Permits force pushes to protected branch. Default false. For more information see [docs](https://help.github.com/en/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch) |
allow_deletions |
Allow deletions of the protected branch. Discouraged usage. Default false. For more information see [docs](https://help.github.com/en/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch) |
enforce_admins |
Enforce all configured restrictions for adminstrators. Defaults to false. |
repo_spec |
Full text "owner/spec" text. Defaults to determining from your git files. |
auth_token |
Github token. Defaults to detecting from Set.env but can use config. |
host |
Passed on to gh api. Defaults to NULL |
return_type |
In ‘get_branch_protection', return either the full list response with ’verbose' or a boolean with 'exists' if the branch is protected. |
invisibly returns API object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Check first to see if master is protected
# Equivalent
is_master_protected()
get_branch_protection()
# Default call - protect master branch requiring 1 reviewer
protect_branch()
protect_master()
# Look at full settings of branch
get_branch_protection(return_type = "verbose")
# Alternatives settings are included in additional optional features and can change protection settings with overwrite=FALSE
protect_branch("master",overwrite = TRUE, required_approving_review_count = 2, enforce_admins = FALSE)
# See that branch is protected differently now
get_branch_protection(return_type = "verbose")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.