Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: Ruleset, required_check should be optional #2467

Open
1 task done
marcomansi-ahold opened this issue Nov 19, 2024 · 1 comment
Open
1 task done

[BUG]: Ruleset, required_check should be optional #2467

marcomansi-ahold opened this issue Nov 19, 2024 · 1 comment
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented

Comments

@marcomansi-ahold
Copy link

marcomansi-ahold commented Nov 19, 2024

Expected Behavior

I want to create a ruleset with a required status check with only "Require branches to be up to date before merging" enabled, like this (created through the UI):

image

Actual Behavior

Error:

│ Error: PUT https://api.github.com/repos/RoyalAholdDelhaize/gso-tech-test-marco_mansi-1/rulesets/2669259: 422 Validation Failed [{Resource: Field: Code: Message:Invalid rule 'required_status_checks': Invalid parameter required_status_checks: Invalid array contents. Errors at index 0: Expected context to be present}]

│ with module.gso_github_repo["gso-tech-test-marco_mansi-1"].github_repository_ruleset.ruleset,
│ on gso_github_repo/main.tf line 84, in resource "github_repository_ruleset" "ruleset":
│ 84: resource "github_repository_ruleset" "ruleset" {

Terraform Version

Terraform 1.9.8
integrations/github 6.3.1

Affected Resource(s)

  • github_repository_ruleset

Terraform Configuration Files

No response

Steps to Reproduce

I am using this code:

resource "github_repository_ruleset" "ruleset" {
  name        = "PRs & conventional commits"
  repository  = github_repository.repo.name
  target      = "branch"
  enforcement = "active"

  conditions {
    ref_name {
      include = ["~DEFAULT_BRANCH"]
      exclude = []
    }
  }

  rules {
    creation                = true
    update                  = true
    deletion                = true
    required_linear_history = true
    non_fast_forward        = true

    pull_request {
      require_last_push_approval        = true
      dismiss_stale_reviews_on_push     = true
      required_review_thread_resolution = true
      required_approving_review_count   = 1
    }

    required_status_checks {
      required_check {
        context = ""
      }
      strict_required_status_checks_policy = true
    }
  }
}

The required_check block is required and context too. But it cannot be empty

Debug Output

No response

Panic Output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@marcomansi-ahold marcomansi-ahold added Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented labels Nov 19, 2024
@kris-evans
Copy link

I'm currently experience this as well. This is actually blocking our ability to configure repositories with the Terraform provider as it overwrites the rules on deploy.

@nickfloyd nickfloyd moved this from 🆕 Triage to 🔥 Backlog in 🧰 Octokit Active Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage This is being looked at and prioritized Type: Bug Something isn't working as documented
Projects
None yet
Development

No branches or pull requests

2 participants