Skip to content
Draft
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
18 changes: 18 additions & 0 deletions terraform/deployments/github/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,24 @@ resource "github_branch_protection" "govuk_repos" {
}
}

resource "github_actions_repository_permissions" "gha_permissions" {
for_each = {
for name, repo in local.repositories : name => data.github_repository.govuk["alphagov/${name}"]
if try(repo.restrict_github_actions.enabled, false) && contains(keys(data.github_repository.govuk), "alphagov/${name}")
}

repository = each.key

enabled = true
allowed_actions = "selected"

allowed_actions_config {
github_owned_allowed = true
patterns_allowed = local.repositories[each.key].restrict_github_actions.restricted_action_patterns
verified_allowed = false
}
}

#
# Only the list of repositories which will have access to a secret is created/modified
# here, the secret should have been created in the GitHub UI in advance by a
Expand Down
Loading
Loading