Skip to content

Commit

Permalink
Merge branch 'deployment-key'
Browse files Browse the repository at this point in the history
  • Loading branch information
arnol377 committed Apr 4, 2025
2 parents 2fda0f4 + e4dab44 commit 1e0a7d2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ No modules.
| <a name="input_template_repo_org"></a> [template\_repo\_org](#input\_template\_repo\_org) | Template repository organization | `string` | `null` | no |
| <a name="input_vars"></a> [vars](#input\_vars) | GitHub Actions variables | <pre>list(object({<br> name = string<br> value = string<br> }))</pre> | `[]` | no |
| <a name="input_vulnerability_alerts"></a> [vulnerability\_alerts](#input\_vulnerability\_alerts) | Enable Dependabot alerts | `bool` | `false` | no |
| <a name="input_deploy_keys"></a> [deploy\_keys](#input\_deploy\_keys) | List of SSH deploy keys to add to the repository | <pre>list(object({<br> title = string<br> key = string<br> read_only = optional(bool, true)<br> }))</pre> | `[]` | no |

## Outputs

Expand Down
5 changes: 4 additions & 1 deletion branch_protection.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ resource "github_branch_protection" "protection" {
depends_on = [
github_repository.repo,
github_branch.branch,
github_branch_default.default_main_branch
github_branch_default.default_main_branch,
github_repository_files.extra_files,
github_repository_file.codeowners,
github_repository_file.managed_extra_files
]
}
32 changes: 16 additions & 16 deletions github_files.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,27 @@ resource "github_repository_file" "codeowners" {
}
}

# data "github_repository" "template_repo" {
# count = var.template_repo == null && var.template_repo_org == var.repo_org ? 0 : 1
# full_name = "${var.template_repo_org == null ? "" : var.template_repo_org}/${var.template_repo == null ? "" : var.template_repo}"
# }
data "github_repository" "template_repo" {
count = var.template_repo == null && var.template_repo_org == var.repo_org ? 0 : 1
full_name = "${var.template_repo_org == null ? "" : var.template_repo_org}/${var.template_repo == null ? "" : var.template_repo}"
}

# data "github_ref" "ref" {
# count = var.template_repo == null && var.template_repo_org == var.repo_org ? 0 : 1
# owner = var.template_repo_org
# repository = var.template_repo
# ref = "heads/${element(data.github_repository.template_repo, 0).default_branch}"
# }
data "github_ref" "ref" {
count = var.template_repo == null && var.template_repo_org == var.repo_org ? 0 : 1
owner = var.template_repo_org
repository = var.template_repo
ref = "heads/${element(data.github_repository.template_repo, 0).default_branch}"
}

locals {
extra_files = concat(
var.extra_files,
# var.template_repo == null && var.template_repo_org == var.repo_org ? [] : [
# {
# path = ".TEMPLATE_SHA",
# content = data.github_ref.ref[0].sha
# }
# ]
var.template_repo == null && var.template_repo_org == var.repo_org ? [] : [
{
path = ".TEMPLATE_SHA",
content = data.github_ref.ref[0].sha
}
]
)
repository_name = var.create_repo ? local.github_repo.name : var.name
}
Expand Down

0 comments on commit 1e0a7d2

Please sign in to comment.