Skip to content

copilot code review settings

Kazushi Kamegawa edited this page Nov 9, 2026 · 1 revision

Repository Copilot Code Review settings

日本語

Summary

Add declarative management of repository-level GitHub Copilot code review tuning under settings.copilotCodeReview, covering review effort, custom instructions, MCP use, and severity filtering through the repository Copilot settings API. Automatic review requests, reviews on new pushes, and draft reviews remain expressible through the existing copilot_code_review ruleset.

Tracking

Type Issue
Feature Issue #53

Background

GitHub added REST and GraphQL APIs to manage Copilot code review settings. The repository REST endpoint exposes review effort, whether review uses repository custom instructions and MCP servers, and a severity filter. The repository settings endpoint tunes reviews but does not enable Copilot code review. Automatic review behavior is configured through rulesets, whose copilot_code_review rule accepts review_on_push and review_draft_pull_requests parameters. GitHub's release notes describe the endpoints and token requirements (changelog, API reference, rules API reference).

The REST API version already pinned by the client is 2026-03-10. A GET using the authenticated local GitHub CLI token returned 200 for this repository. The existing planner also recognizes a copilot_code_review ruleset. No live PATCH or live ruleset apply has been performed.

Design

settings:
  copilotCodeReview:
    reviewEffort: balanced
    customInstructionsEnabled: true
    mcpEnabled: false
    severityFilter: low
  1. Configuration. Add optional settings.copilotCodeReview fields: reviewEffort, customInstructionsEnabled, mcpEnabled, and severityFilter. Omitted fields remain unmanaged, and optional boolean pointers preserve explicit false. reviewEffort accepts a value exposed in available_review_efforts or inherit. The accepted severity values are no_filter, low, and low_and_medium. Keep schemaVersion at 1.
  2. API and convergence. Add typed GET and PATCH operations for /repos/{owner}/{repo}/copilot/code-review/settings. plan compares declared fields against configured state. A failed read or an unavailable requested review effort blocks the plan. For an existing repository, apply re-reads the settings and sends one PATCH containing only declared fields that differ. It sends no PATCH for a no-op. For a newly created repository, plan the declared settings for application after creation, then apply them in the existing repository settings stage. GitHub validates the PATCH atomically. Return and report GitHub validation or permission errors.
  3. Review effort inheritance. GET returns review_effort.configured and effective. A null configured value can mean inherited effort or a saved value that is no longer available. Treat null as observationally matching inherit, and never turn effective into a stored override during import. import omits an inherited or otherwise unrepresentable effort and reports a diagnostic. import --into retains any existing declaration when the imported configured value is null.
  4. Import failures. Map readable values into settings.copilotCodeReview. For non-rate-limit HTTP 403 or HTTP 404, omit the section in fresh import and report a diagnostic. Authentication errors, rate limits, and transport errors fail the import. A successful GET supplies available_review_efforts; use it to validate any explicit effort before planning an update. GitHub remains the authority for whether severity filtering can be changed on a given repository.
  5. Credentials and README. A local gh auth login OAuth token or classic PAT needs the repo scope, and its user must be a repository administrator. GitHub App and fine-grained PAT tokens need repository Administration: read for GET and Administration: write for PATCH. GitHub Actions' built-in GITHUB_TOKEN cannot receive the required Administration permission through workflow permissions; Use a GitHub App token or PAT in CI with the permissions appropriate to a read-only or apply job. Update both README.md and README_ja.md with these permission requirements and the local CLI and CI guidance.
  6. Scope. This change manages repository-level review tuning and automatic-review rules declared through repository rulesets. Enterprise and organization policy, billing, maximum effort limits, and approval policy are not part of the repository setting implementation. The Copilot code review settings API does not enable the feature by itself.

Implementation phases

  1. Add the configuration types, semantic validation, and JSON Schema. Add REST request and response types and client methods.
  2. Add plan comparison and apply to the repository settings stage. Extend importer mapping and declared-only YAML/JSON refresh behavior.
  3. Update English and Japanese design documentation, both READMEs, and relevant examples. Add API-client, planner, importer, and refresh tests.

Verification

Automated tests cover endpoint paths, methods, API version headers, PATCH bodies, configured and inherited review effort, dynamic available-effort validation, explicit false values, per-field differences, permission and service errors, plan convergence after apply, import diagnostics, and YAML/JSON --into updates. Validate configuration in both YAML and JSON and confirm the two READMEs state the token requirements for local gh and CI. After automated tests pass, use a test repository to run plan, apply, re-import, and a repeated plan; verify updated values with GET and confirm the second plan has no drift. Restore the original setting after verification. Live write verification is pending.

Clone this wiki locally