terraform-provider-github icon indicating copy to clipboard operation
terraform-provider-github copied to clipboard

[FEAT]: Add automatic_copilot_code_review_enabled support for repository rules

Open lkiii opened this issue 6 months ago • 8 comments

Describe the need

gh api repos/org/repo/rules/branches/main returns

  {
    "type": "pull_request",
    "parameters": {
      "required_approving_review_count": 1,
      "dismiss_stale_reviews_on_push": true,
      "require_code_owner_review": true,
      "require_last_push_approval": true,
      "required_review_thread_resolution": true,
      "automatic_copilot_code_review_enabled": true,
      "allowed_merge_methods": [
        "merge",
        "squash",
        "rebase"
      ]
    },

Which shows the flag automatic_copilot_code_review_enabled

Terraform provider should support setting this flag

SDK Version

No response

API Version

No response

Relevant log output

Unexpected attribute: An attribute named "automatic_copilot_code_review_enabled" is not expected here

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

lkiii avatar Jul 02 '25 09:07 lkiii

Would love this feature too. FYI - there's another request for this: https://github.com/integrations/terraform-provider-github/issues/2583

nnellanspdl avatar Jul 09 '25 15:07 nnellanspdl

YES PLEASE!!!!!

jason-berk-k1x avatar Jul 25 '25 18:07 jason-berk-k1x

+100

jeffsewell avatar Jul 25 '25 18:07 jeffsewell

This is needed - Duplicate #2583

emouawad avatar Aug 04 '25 12:08 emouawad

💯

johnyjim avatar Sep 09 '25 22:09 johnyjim

As an update to this, there is now a second, newer way to enable Copilot Code Review on a Ruleset. It is enabled via its own rule, which lives outside of the pull_request rule.

This new way/rule shows as "type": "copilot_code_review" and has some new features that don't exist in the original way, namely options for:

  • Review new pushes: Copilot automatically reviews each new push to the pull request.
  • Review draft pull requests: Copilot automatically reviews draft pull requests before they are marked as ready for review.

So, as of now, there are 2 different ways to accomplish this:

  1. In a Ruleset, under the PR settings
  2. In a Ruleset using a new top-level option, along with 2 new sub-settings

nnellanspdl avatar Nov 28 '25 20:11 nnellanspdl

Hey @nnellanspdl

Thanks for bringing this to our attention! We're focusing on some big underlying changes to get v7.0 released and won't most likely be working on new features until then.

If you'd want to contribute a PR we'd be very grateful for that! ☺️

deiga avatar Nov 29 '25 13:11 deiga

Hey @deiga would you please review this PR based on the suggestion from @nnellanspdl

this feature is based on https://github.blog/changelog/2025-09-10-copilot-code-review-independent-repository-rule-for-automatic-reviews/

JiayangZhou avatar Dec 04 '25 12:12 JiayangZhou