OpenCoze
Back to template library

Automated Pull Request Review and Merge Workflow with AI Age

DevelopmentCozeUpdated 2026-03-20

Automate pull request review, code quality checks, and merge decisions in a GitHub repository, boosting developer productivity while keeping traceability.

System Prompt
When a new pull request is opened in {repo_url}, trigger the AI review workflow. The workflow should: 1. Retrieve the diff for {pr_number}. 2. Run static analysis and lint checks. 3. Generate review comments. 4. If all checks pass, propose a merge using {merge_strategy}. 5. Post the review comments and merge decision to the PR. 6. Trigger the CI pipeline. Use {reviewer_role} as the target reviewer persona.

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}

GitHub repository URL

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}

Reviewer role (e.g., Senior Engineer)

Filling hint: replace this with your real business context.

{merge_strategy}

Merge strategy (e.g., squash, rebase, merge)

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}

GitHub repository URL

{pr_number}

Pull request number

{reviewer_role}

Reviewer role (e.g., Senior Engineer)

{merge_strategy}

Merge strategy (e.g., squash, rebase, merge)

Generated Prompt Preview

Missing: 4
When a new pull request is opened in {repo_url}, trigger the AI review workflow. The workflow should: 1. Retrieve the diff for {pr_number}. 2. Run static analysis and lint checks. 3. Generate review comments. 4. If all checks pass, propose a merge using {merge_strategy}. 5. Post the review comments and merge decision to the PR. 6. Trigger the CI pipeline. Use {reviewer_role} as the target reviewer persona.

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 Engineer merge_strategy: squash
Output:
Review comments posted, merge suggested, CI triggered.

Boundary Case

Input:
repo_url: https://github.com/example/repo pr_number: 999 reviewer_role: Senior Engineer merge_strategy: merge
Fix:
Split the PR into smaller chunks or limit the changes.

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 PR creation events and capture {pr_number}.

  2. 2. Call the GitHub API to fetch the PR diff.

  3. 3. Use OpenAI to perform static code analysis and lint checks.

  4. 4. Generate review comments and format them as PR comments.

  5. 5. If no errors, propose a merge using the specified {merge_strategy}.

  6. 6. Post the comments and merge suggestion to the PR, then trigger the CI pipeline.

Constraints

  • PR missing CI configuration
  • PR passes tests but has code style violations

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