From eee6727abd726300dfccf147b98323ecb84aae94 Mon Sep 17 00:00:00 2001 From: MarcoIeni <11428655+MarcoIeni@users.noreply.github.com> Date: Wed, 12 Feb 2025 12:56:02 +0100 Subject: [PATCH] add repo variable --- terragrunt/modules/rustc-ci/_terraform.tf | 13 +++++++++++++ terragrunt/modules/rustc-ci/artifacts.tf | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/terragrunt/modules/rustc-ci/_terraform.tf b/terragrunt/modules/rustc-ci/_terraform.tf index 7ee0c33f..9f11bdc1 100644 --- a/terragrunt/modules/rustc-ci/_terraform.tf +++ b/terragrunt/modules/rustc-ci/_terraform.tf @@ -8,3 +8,16 @@ terraform { } } } + +variable "repo" { + description = "GitHub repository to authorize. E.g. `rust`. GitHub org is hardcoded to `rust-lang`." + type = string + validation { + condition = !can(regex("/", var.repo)) + error_message = "The repo variable must not contain `/`. Only provide the repository name." + } + validation { + condition = length(var.repo) > 0 + error_message = "The repo variable must not be empty." + } +} diff --git a/terragrunt/modules/rustc-ci/artifacts.tf b/terragrunt/modules/rustc-ci/artifacts.tf index c928a156..c42adb0f 100644 --- a/terragrunt/modules/rustc-ci/artifacts.tf +++ b/terragrunt/modules/rustc-ci/artifacts.tf @@ -172,7 +172,7 @@ resource "aws_iam_role" "try_builds" { } Condition = { StringEquals = { - "token.actions.githubusercontent.com:sub" = "repo:rust-lang/rust:ref:refs/heads/automation/bors/try" + "token.actions.githubusercontent.com:sub" = "repo:rust-lang/${var.repo}:ref:refs/heads/automation/bors/try" } } }