Skip to content

fix(repository-environment): match PROTECTED_BRANCH deployment restriction - #55

Merged
posquit0 merged 1 commit into
mainfrom
fix/repository-environment-protected-branch
Nov 20, 2026
Merged

posquit0 merged 1 commit into
mainfrom
fix/repository-environment-protected-branch

Conversation

@posquit0

@posquit0 posquit0 commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Background

  • deployment_policy.restriction accepts NONE, PROTECTED_BRANCH, or CUSTOM (modules/repository-environment/variables.tf:76, and the same values are documented in modules/repository/variables.tf). But modules/repository-environment/main.tf:54 compared against "PROTECTED_BRANCHES", which can never match.
  • Impact: with restriction = "PROTECTED_BRANCH", the module renders a deployment_branch_policy block with protected_branches = false and custom_branch_policies = false, so the protected-branch restriction is never applied (or the GitHub API rejects the request, since one of the two must be true).

Description

  • modules/repository-environment/main.tf: compare with "PROTECTED_BRANCH".
  • No README change (variables and outputs are unchanged).

🚨 To Reviewers

  • Validation:
    • Mock-provider terraform test (temporary test file, not committed) with restriction = "PROTECTED_BRANCH" asserting deployment_branch_policy[0].protected_branches == true:
      • origin/main: fails (actual false).
      • this branch: passes.
    • terraform fmt -check -recursive clean; terraform init -backend=false + terraform validate in modules/repository-environment succeed.
    • Not tested: apply against the GitHub API.

Worktree: ~/.git-worktrees/tedilabs/terraform-github-modules/repository-environment-protected-branch/

@github-actions github-actions Bot added 💾 repository-environment This issue or pull request is related to repository-environment module. size/XS Extra Small size issue or PR. labels Nov 20, 2026
@github-actions

Copy link
Copy Markdown

Terraform Integration

Directory fmt validate tflint docs
modules/repository-environment ✅ ✅ ✅ ✅

✅ All 1 passed.

@posquit0
posquit0 merged commit a630114 into main Nov 20, 2026
7 checks passed
@posquit0
posquit0 deleted the fix/repository-environment-protected-branch branch November 20, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💾 repository-environment This issue or pull request is related to repository-environment module. size/XS Extra Small size issue or PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant