Skip to content

Add github_repository_environment_deployment_protection_rule resource#3566

Open
stockmaj wants to merge 5 commits into
integrations:mainfrom
stockmaj:dpr-6.13
Open

Add github_repository_environment_deployment_protection_rule resource#3566
stockmaj wants to merge 5 commits into
integrations:mainfrom
stockmaj:dpr-6.13

Conversation

@stockmaj

Copy link
Copy Markdown

Summary

Adds a github_repository_environment_deployment_protection_rule resource that enables a GitHub App as a custom deployment protection rule on an environment — the deployment_protection_rule gate. The provider can currently manage required reviewers and branch policies on an environment, but has no way to declaratively attach an App-based deployment protection rule.

Resolves #2225.

Details

  • CRUD + import over go-github's CreateCustomDeploymentProtectionRule / GetCustomDeploymentProtectionRule / DisableCustomDeploymentProtectionRule.
  • Schema: repository + environment + integration_id (the App's ID), mirroring the existing github_repository_environment_deployment_policy resource for consistency.
  • Import ID format <repository>:<environment>:<rule_id>.
  • Docs page added under docs/resources/.

Branch is cut from the v6.13.0 release.

Enables a GitHub App as a custom deployment protection rule on an environment
(the deployment_protection_rule gate), which the provider previously could not
express declaratively — resolves integrations#2225.

CRUD + import over go-github's Create/Get/DisableCustomDeploymentProtectionRule;
schema is repository + environment + integration_id, mirroring the existing
github_repository_environment_deployment_policy resource. Based on v6.13.0.
@github-actions

Copy link
Copy Markdown

👋 Hi, and thank you for this contribution!

This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can.

You can help us prioritize by joining the discussion on open issues and PRs, sharing details on the changes you need, and reviewing other contributions.


🤖 This is an automated message.

stockmaj and others added 4 commits July 22, 2026 09:23
InternalValidate rejects the resource: with no UpdateContext, every attribute
must be ForceNew. repository was Required-only. Mark it ForceNew and drop the
now-redundant diffRepository CustomizeDiff (it keys off a repository_id this
resource doesn't have). `go test -run TestProvider` (InternalValidate) passes.
main upgraded go-github v88 -> v89; the CreateCustomDeploymentProtectionRule
request type moved packages. Match the rest of the provider.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: Add support for deployment protection rules

1 participant