OpenCoze
Back to template library

Automate Pull Request Review with GitHub Copilot

DevelopmentCozeUpdated 2026-05-25

Automatically fetch PR diffs, generate AI-driven review comments, and post them back to GitHub to improve code quality and review speed for small to medium teams.

System Prompt
Retrieve the diff of pull request {pr_number} from repository {repo_url}, analyze the changes, and generate concise review comments for the role {reviewer_role}. Return the comments in JSON format with fields: file, line, comment.

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_url}

Full GitHub repository URL, e.g., https://github.com/owner/repo

Filling hint: replace this with your real business context.

{pr_number}

Pull request number, e.g., 42

Filling hint: replace this with your real business context.

{reviewer_role}

Reviewer role, e.g., "Senior Backend Engineer"

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_url}

Full GitHub repository URL, e.g., https://github.com/owner/repo

{pr_number}

Pull request number, e.g., 42

{reviewer_role}

Reviewer role, e.g., "Senior Backend Engineer"

Generated Prompt Preview

Missing: 3
Retrieve the diff of pull request {pr_number} from repository {repo_url}, analyze the changes, and generate concise review comments for the role {reviewer_role}. Return the comments in JSON format with fields: file, line, comment.

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:
repo_url: https://github.com/example/repo pr_number: 42 reviewer_role: Senior Backend Engineer
Output:
[{"file":"src/main.py","line":10,"comment":"Consider using a more secure random number generator."},{"file":"tests/test_main.py","line":5,"comment":"Missing unit tests for exception handling."}]

Boundary Case

Input:
repo_url: https://github.com/invalid/repo pr_number: 999 reviewer_role: Senior Backend Engineer
Fix:
Verify that the repository URL is correct and the PR number exists.

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. Use the GitHub API to fetch the diff of PR {pr_number}.

  2. 2. Send the diff to OpenAI with a system prompt to generate review comments.

  3. 3. Parse the returned JSON to extract file, line, and comment.

  4. 4. Use the GitHub API to post the comments back to the PR.

  5. 5. Notify the team via Slack or email.

Constraints

  • Large diffs over 10,000 lines may require batching or truncating input for the model.
  • Private repositories need a valid access token.
  • PRs with no changes will return an empty comment list.

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

OpenAI

Official site

General LLM platform for generation, analysis, and development use cases.

Open