Important
Once you reach bypassers in rulesets or branch protection rules,
remember that a Github Application can also be a bypasser.
Currently we support only public Github Apps as bypassers,
and such should be set as a bypasser in format app/<app_name>
These are the primary configuration options for each repository.
name does not exist. The name of the YAML file is the name of the repository.
-
default_branch: (required, string) Specifies the default branch for the repository. Example:main. -
description: (optional, string) A brief description of the repository. -
visibility: (optional, string) Defines the visibility of the repository. Possible values:publicprivate
-
homepage_url: (optional, string) The URL to the repository's homepage or website. -
has_issues: (optional, boolean) Iftrue, the repository has issue tracking enabled. -
has_projects: (optional, boolean) Iftrue, the repository has project boards enabled. -
has_wiki: (optional, boolean) Iftrue, the repository has a wiki enabled. -
has_downloads: (optional, boolean) Iftrue, the repository allows downloads (e.g., binary assets). -
allow_merge_commit: (optional, boolean) Iftrue, merge commits are allowed. -
allow_rebase_merge: (optional, boolean) Iftrue, rebase merging is allowed. -
allow_squash_merge: (optional, boolean) Iftrue, squash merging is allowed. -
allow_auto_merge: (optional, boolean) Iftrue, auto-merging is allowed when conditions are met. -
allow_update_branch: (optional, boolean) Iftrue, contributors can update the branch from the default. -
squash_merge_commit_title: (optional, string) Defines the default title for squash merge commits. Ifallow_squash_mergeis set to true, than this is set to one of:PR_TITLECOMMIT_OR_PR_TITLE
-
squash_merge_commit_message: (optional, string) Defines the default commit message for squash merges. Ifallow_squash_mergeis set to true, than this is set to one of:PR_BODYCOMMIT_MESSAGESBLANK
-
merge_commit_title: (optional, string) Defines the default title for merge commits. Ifallow_merge_commitis set to true, than this is set to one of:PR_TITLEMERGE_MESSAGE
-
merge_commit_message: (optional, string) Defines the default message for merge commits. Ifallow_merge_commitis set to true, than this is set to one of:PR_BODYPR_TITLEBLANK
-
web_commit_signoff_required: (optional, boolean) Iftrue, commit signoff is required for web-based commits. -
delete_branch_on_merge: (optional, boolean) Iftrue, the branch will be deleted after the merge. -
is_template: (optional, boolean) Iftrue, the repository is a template repository. -
archived: (optional, boolean) Iftrue, the repository is archived. -
has_discussions: (optional, boolean) Iftrue, the repository has discussions enabled. -
topics: (optional, string[]) A list of topics or tags to categorize the repository. -
pull_collaborators: (optional, string[]) A list of users with pull access to the repository. -
triage_collaborators: (optional, string[]) A list of users with triage access to the repository. -
push_collaborators: (optional, string[]) A list of users with push access to the repository. -
maintain_collaborators: (optional, string[]) A list of users with maintain access to the repository. -
admin_collaborators: (optional, string[]) A list of users with admin access to the repository. Deprecated: this field will be removed in a future version. -
pull_teams: (optional, string[]) A list of teams with pull access to the repository. -
triage_teams: (optional, string[]) A list of teams with triage access to the repository. -
push_teams: (optional, string[]) A list of teams with push access to the repository. -
maintain_teams: (optional, string[]) A list of teams with maintain access to the repository. -
admin_teams: (optional, string[]) A list of teams with admin access to the repository. Deprecated: this field will be removed in a future version. -
license_template: (optional, string) The license template to use for the repository. Use the name of the template without the extension. For example, "mit" or "mpl-2.0". -
gitignore_template: (optional, string) The gitignore template to use for the repository. Use the name of the template without the extension. For example, "Haskel" -
template: (optional, object RepositoryTemplate) Configuration for creating a repository from a template. -
pages: (optional, object Pages) Configuration for GitHub Pages. -
rulesets: (optional, object[] Ruleset) Configuration for repository rulesets. -
vulnerability_alerts_enabled: (optional, boolean) Iftrue, vulnerability alerts are enabled. -
branch_protections_v4: (optional, object[] BranchProtectionV4) Configuration for branch protection rules. -
custom_properties: (optional, map[string]string) A map of GitHub organization custom property names to their string values. See Custom Properties. -
high_integrity: (optional, object HighIntegrity) Expansion directives for high-integrity repositories. This field is consumed by theexpandcommand and is not passed to Terraform — it is removed from the output after expansion.
Options for enabling high-integrity mode on a repository. This block is a pre-processing directive consumed by the expand command — it is not forwarded to Terraform.
When enabled is true, the expand command automatically appends two rulesets to the repository's rulesets list:
- Protect main branch — an active branch ruleset targeting
~DEFAULT_BRANCHthat enforces deletion protection, no fast-forward pushes, linear history, and a pull request review policy (1 approver, stale review dismissal on push, last-push approval required). - Make tags immutable — an active tag ruleset targeting
~ALLthat prevents deletion, non-fast-forward updates, and tag updates.
The high_integrity block is then removed from the expanded output.
enabled: (required, boolean) Iftrue, the two high-integrity rulesets are injected during expansion.
Example:
high_integrity:
enabled: trueGitHub organization custom properties allow organizations to attach structured metadata to repositories — such as lifecycle stage, team ownership, compliance classification, or any other organization-defined attribute. They are defined once at the organization level and can then be set per repository.
The custom_properties field is a map of property names to their string values. Custom properties must be defined at the organization level before they can be set on a repository. Only string-type custom properties are supported.
Example:
custom_properties:
oss_lifecycle: active
team: platformOptions for configuring a repository from a template.
-
owner: (required, string) The owner of the template repository. -
repository: (required, string) The name of the template repository.
Options for configuring GitHub Pages.
-
build_type: (required, string) The build type for GitHub Pages. Possible values:workflow- Pages are deployed via a GitHub Actions workflow. Onlycnameandbuild_typeare required;branchandpathmust not be set.legacy- Pages are deployed from a branch.branchis required in addition tobuild_type.
-
cname: (optional, string) The custom domain for GitHub Pages. -
branch: (required whenbuild_typeislegacy, string) The branch to use for GitHub Pages. -
path: (optional, string) The directory path for GitHub Pages content. Only applicable whenbuild_typeislegacy.
Options for configuring repository rulesets.
-
enforcement: (required, string) The enforcement level of the ruleset. One of:disabledactiveevaluate- currently only supported for owners of type organization
-
name: (required, string) The name of the ruleset. -
rules: (required, object Rule) The rules included in the ruleset. -
target: (required, string) The target of the ruleset. -
bypass_actors: (optional, object[] BypassActor) Actors that can bypass the ruleset. -
conditions: (optional, object Conditions) Conditions for the ruleset. -
repository: (optional, string) The repository to which the ruleset applies.
Options for configuring rules within a ruleset.
-
branch_name_pattern: (optional, object PatternRule) Pattern rule for branch names. Conflicts withtag_name_pattern. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. -
tag_name_pattern: (optional, object PatternRule) Pattern rule for tag names. Conflicts withbranch_name_pattern. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. -
commit_author_email_pattern: (optional, object PatternRule) Pattern rule for commit author emails. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. -
commit_message_pattern: (optional, object PatternRule) Pattern rule for commit messages. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. -
committer_email_pattern: (optional, object PatternRule) Pattern rule for committer emails. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. -
creation: (optional, boolean) Iftrue, creation is allowed or required. -
deletion: (optional, boolean) Iftrue, deletion is allowed or required. -
non_fast_forward: (optional, boolean) Iftrue, non-fast-forward pushes are allowed or required. -
pull_request: (optional, object PullRequestRule) Configuration for pull request rules. -
required_deployments: (optional, object RequiredDeployments) Configuration for required deployments. -
required_linear_history: (optional, boolean) Iftrue, a linear commit history is required. -
required_signatures: (optional, boolean) Iftrue, commit signatures are required. -
required_status_checks: (optional, object RequiredStatusChecks) Configuration for required status checks. -
tag_name_pattern: (optional, object PatternRule) Pattern rule for tag names. -
required_code_scanning: (optional, object RequiredCodeScanning) Configuration for required code scanning. -
update: (optional, boolean) Iftrue, updates are allowed or required. -
update_allows_fetch_and_merge: (optional, boolean) Iftrue, fetch and merge updates are allowed.
Options for configuring pattern rules.
-
operator: (required, string) The operator for the pattern rule. One of:starts_withends_withcontainsregex
-
pattern: (required, string) The pattern to match. -
name: (optional, string) The name of the pattern rule. -
negate: (optional, boolean) Iftrue, the pattern match is negated.
Options for configuring pull request rules.
-
dismiss_stale_reviews_on_push: (optional, boolean) Iftrue, stale reviews are dismissed on push. -
require_code_owner_review: (optional, boolean) Iftrue, code owner review is required. -
require_last_push_approval: (optional, boolean) Iftrue, approval of the last push is required. -
required_approving_review_count: (optional, integer) The number of required approving reviews. -
required_review_thread_resolution: (optional, boolean) Iftrue, resolution of review threads is required.
Options for configuring required deployments.
required_deployment_environments: (required, string[], `minItems=1) A list of required deployment environments.
Options for configuring required status checks.
-
required_check: (required, object[] RequiredCheck,minItems=1) A list of required status checks. -
strict_required_status_checks_policy: (optional, boolean) Iftrue, strict status check policy is enforced.
Options for configuring a required status check.
-
context: (required, string) The context of the status check. -
source: (required, string) Name of required check source. Usually an integration (Github app) name. Formatapp/<app-owner>/<app-slug>, both can be obtained fromapp-list.yaml
Options for configuring required code scanning.
required_code_scanning_tool: (required, object[] RequiredCodeScanningTool,minItems=1) A list of required code scanning tools.
Options for configuring a required code scanning tool.
-
alerts_threshold: (required, string) The threshold for alerts. One of:noneerrorserrors_and_warningsall
-
security_alerts_threshold: (required, string) The threshold for security alerts. One ofLnonecriticalhigh_or_highermedium_or_higherall
-
tool: (optional, string) The name of the code scanning tool.
Options for configuring actors that can bypass rules.
-
name: (required, string) The name of the actor. Can be an actor role, a team or an integration (Github app). Teams should be prefixed withteam/<team-slug>. Apps are prefixed withapp/<app-owner>/<app-slug>. If an actor role, then of:repository-admin-roleorganization-admin-rolemaintain-rolewrite-role
-
bypass_mode: (optional, enum) The bypass mode for the actor. One of:alwayspull_request
Options for configuring conditions for rulesets.
ref_name: (required, object RefNameCondition) Reference name conditions.
Options for configuring reference name conditions.
-
exclude: (required, string[],minItems=1) A list of reference names to exclude. -
include: (required, string[],minItems=1) A list of reference names to include. Also accepts~DEFAULT_BRANCHto include the default branch or~ALLto include all branches.
Options for configuring branch protection rules.
-
pattern: (required, string) The pattern for branches to protect. -
allows_deletions: (optional, boolean) Iftrue, branch deletion is allowed. -
allows_force_pushes: (optional, boolean) Iftrue, force pushes are allowed. Set tofalseifforce_push_bypassersis set. -
force_push_bypassers: (optional, string[]) A list of users or teams allowed to force push. If set, thenallows_force_pushesmust be set tofalse. -
blocks_creations: (optional, boolean) Iftrue, branch creation is blocked. -
enforce_admins: (optional, boolean) Iftrue, admins are also subject to branch protection. -
push_restrictions: (optional, string[]) A list of users or teams allowed to push. -
require_conversation_resolution: (optional, boolean) Iftrue, resolution of conversations is required. -
require_signed_commits: (optional, boolean) Iftrue, signed commits are required. -
required_linear_history: (optional, boolean) Iftrue, a linear commit history is required. -
required_pull_request_reviews: (optional, object RequiredPullRequestReviews) Configuration for required pull request reviews. -
required_status_checks: (optional, object RequiredStatusChecksV4) Configuration for required status checks. -
restricts_pushes: (optional, boolean) Iftrue, pushes are restricted. -
lock_branch: (optional, boolean) Iftrue, the branch is locked.
Options for configuring required pull request reviews.
-
required_approving_review_count: (optional, integer) The number of required approving reviews. Must be between 0 and 6 -
dismiss_stale_reviews: (optional, boolean) Iftrue, stale reviews are dismissed. -
require_code_owner_reviews: (optional, boolean) Iftrue, code owner reviews are required. -
dismissal_restrictions: (optional, string[]) A list of users or teams allowed to dismiss reviews. -
restrict_dismissals: (optional, boolean) Iftrue, review dismissals are restricted. -
pull_request_bypassers: (optional, string[]) A list of users or teams allowed to bypass pull request requirements. -
require_last_push_approval: (optional, boolean) Iftrue, approval of the last push is required.
Options for configuring required status checks in V4.
-
strict: (optional, boolean) Iftrue, strict status checks are enforced. -
contexts: (optional, string[]) A list of required status check contexts.