Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ No modules.
| [github_team.developers](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team) | resource |
| [github_team_membership.admins_xnoto](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team_membership) | resource |
| [github_team_repository.admins](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team_repository) | resource |
| [github_app.chart_updater](https://registry.terraform.io/providers/integrations/github/latest/docs/data-sources/app) | data source |
| [sops_file.secret_vars](https://registry.terraform.io/providers/carlpett/sops/latest/docs/data-sources/file) | data source |

## Inputs
Expand Down
16 changes: 13 additions & 3 deletions gh-protections.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Resolve the chart updater App to its GraphQL node ID. Branch protection
# allowances cannot use the App's numeric ID or bot login directly.
data "github_app" "chart_updater" {
slug = "makeitworkbot"
}

# Every active public repository requires a pull request with its configured CI
# checks passing before merge, except repositories explicitly assigned the
# relaxed protection profile below. Private repositories are deliberately
Expand Down Expand Up @@ -29,9 +35,13 @@ resource "github_branch_protection" "protections" {
require_last_push_approval = false
}
restrict_pushes {
push_allowances = [
"${var.github_owner}/${github_team.admins.slug}"
]
# Push allowances do not bypass the pull-request or required-check gates.
# The chart updater App is added only for its kustomize-cluster destination
# so GitHub may complete an eligible auto-merge after `test` passes.
push_allowances = concat(
["${var.github_owner}/${github_team.admins.slug}"],
each.key == "kustomize-cluster" ? [data.github_app.chart_updater.node_id] : [],
)
}
# Seed centrally managed files before protecting a newly added repository's
# main branch. Without this ordering, GitHub can reject the file commits as
Expand Down
Loading