OpenCoze
Back to template library

AI-Enhanced Pull Request Review with GitHub Copilot CLI

DevelopmentCozeUpdated 2026-04-07

Automatically invoke Copilot CLI on a PR diff to generate a second‑opinion review and post it as a PR comment, boosting code quality and review speed

System Prompt
When a pull request is opened or updated, run Copilot CLI on the diff of {repo_name} PR #{pr_number} and post the generated review comments as a comment by {reviewer_role}.

Variable Dictionary (fill in your AI tool)

This section only explains placeholders. It is not an input form on this website. Copy the prompt, then replace variables in Coze / Dify / ChatGPT.

{repo_name}

Full GitHub repo name, e.g., user/repo

Filling hint: replace this with your real business context.

{pr_number}

Pull request number

Filling hint: replace this with your real business context.

{reviewer_role}

Name of the automated commenter, e.g., "AI Reviewer"

Filling hint: replace this with your real business context.

{language}

Primary language of the code, e.g., "python"

Filling hint: replace this with your real business context.

Quick Variable Filler (Optional)

Fill variables below to generate a ready-to-run prompt in your browser.

{repo_name}

Full GitHub repo name, e.g., user/repo

{pr_number}

Pull request number

{reviewer_role}

Name of the automated commenter, e.g., "AI Reviewer"

{language}

Primary language of the code, e.g., "python"

Generated Prompt Preview

Missing: 4
When a pull request is opened or updated, run Copilot CLI on the diff of {repo_name} PR #{pr_number} and post the generated review comments as a comment by {reviewer_role}.

How to Use This Template

Best for

Teams that need faster development output with more stable prompt quality.

Problem it solves

Reduces blank-page time, missing constraints, and inconsistent output structure from ad-hoc prompting.

Steps

  1. Copy the template prompt.
  2. Paste it into your AI tool (Coze / Dify / ChatGPT).
  3. Replace placeholder variables using the dictionary above.
  4. Run and refine constraints based on output quality.

Not ideal when

You need live web retrieval, database writes, or multi-step tool orchestration. Use full workflow automation for that.

Success Case

Input:
PR #42 in repo "example/project" adds 12 lines of Python code
Output:
Comment includes 3 improvement suggestions: 1. Use more descriptive variable names; 2. Add unit tests; 3. Replace loop with list comprehension for performance

Boundary Case

Input:
PR #99 in repo "example/project" changes 600 lines of JavaScript
Fix:
Split the large PR into smaller ones or use --max-lines to limit processed lines

What to Try Next

Keep exploring with similar templates and matching tools.

Continue Where You Left Off

No recent items yet.

Workflow Steps

  1. 1. Listen for GitHub PR events (open or update)

  2. 2. Use GitHub CLI to fetch the PR diff

  3. 3. Run Copilot CLI: copilot review --model=second-opinion --repo={repo_name} --pr={pr_number} --lang={language}

  4. 4. Parse the review suggestions from Copilot CLI output

  5. 5. Post a PR comment via GitHub CLI with author {reviewer_role}

  6. 6. Optionally add a label "AI Review" to the PR

Constraints

  • Diffs over 500 lines may cause Copilot CLI errors
  • Unsupported languages will cause Copilot CLI to fail

Explore More in This Category

Development

Recommended Stack

Tools that work well with this template.

Coze

Official site

Low-code agent workflow platform for fast automation delivery.

Open