Skip to content

Conversation

@JiayangZhou
Copy link
Contributor

@JiayangZhou JiayangZhou commented Dec 4, 2025

Add CopilotCodeReviewRuleParameters struct with ReviewNewPushes and ReviewDraftPullRequests fields to support GitHub's Copilot code review rule for repository rulesets.

Changes:

  • Add RulesetRuleTypeCopilotCodeReview constant
  • Add CopilotCodeReviewRuleParameters struct
  • Add CopilotCodeReview field to RepositoryRulesetRules
  • Implement marshaling and unmarshaling logic
  • Add test coverage for the new rule type

this feature is based on https://github.blog/changelog/2025-09-10-copilot-code-review-independent-repository-rule-for-automatic-reviews/ (an independent repository rule instead of pull request rule)

@google-cla
Copy link

google-cla bot commented Dec 4, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@JiayangZhou
Copy link
Contributor Author

This is for Github Terraform provider to support code review bot feature in repo ruleset, relevant PR:

integrations/terraform-provider-github#2965

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.40%. Comparing base (66f826c) to head (8191c33).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
github/rules.go 88.23% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3857      +/-   ##
==========================================
+ Coverage   92.36%   92.40%   +0.04%     
==========================================
  Files         199      200       +1     
  Lines       14308    14410     +102     
==========================================
+ Hits        13215    13315     +100     
- Misses        894      895       +1     
- Partials      199      200       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add support for GitHub's Copilot code review feature in repository
rulesets, allowing automatic code review requests for pull requests.

Changes:
- Add RulesetRuleTypeCopilotCodeReview constant to rule types
- Add CopilotCodeReviewRuleParameters struct with review_new_pushes
  and review_draft_pull_requests fields
- Implement marshal/unmarshal logic for copilot_code_review rules
- Add comprehensive test coverage for the new rule type

The copilot_code_review rule supports two configuration options:
- review_new_pushes: Automatically review each new push to the PR
- review_draft_pull_requests: Automatically review draft PRs
@JiayangZhou JiayangZhou force-pushed the feature/copilot-code-review-ruleset branch from fab8541 to 2b90cfa Compare December 4, 2025 18:51
@gmlewis
Copy link
Collaborator

gmlewis commented Dec 4, 2025

Force-pushing is completely unnecessary. Please see CONTRIBUTING.md for why.

@gmlewis gmlewis added the NeedsReview PR is awaiting a review before merging. label Dec 7, 2025
@gmlewis gmlewis changed the title feat: Add support for copilot_code_review rule type feat: Add support for copilot_code_review rule type Dec 7, 2025
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @JiayangZhou!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear - @zyfy29

Copy link
Contributor

@stevehipwell stevehipwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, but other than that this looks good.

@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Dec 9, 2025
@gmlewis
Copy link
Collaborator

gmlewis commented Dec 9, 2025

Thank you, @JiayangZhou and @stevehipwell!
Merging.

@gmlewis gmlewis merged commit c7473ca into google:master Dec 9, 2025
6 of 7 checks passed
elminster-aom added a commit to elminster-aom/go-github that referenced this pull request Dec 10, 2025
* forkstream/master:
  chore!: Remove `PullRequestRuleParameters.AutomaticCopilotCodeReviewEnabled` field (google#3866)
  feat: Add support for `copilot_code_review` rule type (google#3857)
  feat: Implement Enterprise SCIM - Delete Groups or Users (google#3856)
  feat: Add `advanced_search` parameter to `SearchOptions` (google#3868)
  fix!: Change Org usage report `Quantity` to `float64` (google#3862)
  build(deps): Bump actions/checkout from 6.0.0 to 6.0.1 in the actions group (google#3863)
  build(deps): Bump golang.org/x/sync from 0.18.0 to 0.19.0 in /tools (google#3864)
  build(deps): Bump golang.org/x/term from 0.37.0 to 0.38.0 in /example (google#3865)
  feat: Implement Enterprise SCIM - Set Groups or Users (google#3858)
  feat: Add support for Enterprise Team APIs (google#3861)
  Bump go-github from v79 to v80 in /scrape (google#3855)
  Bump version of go-github to v80.0.0 (google#3854)
  feat: Add repository target to ruleset (google#3850)
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.

3 participants