Skip to main content
Automate code review for every Pull Request. Detailed analysis, security checks, and code suggestions provided by Cline running autonomously in GitHub Actions.

The Workflow

When a PR is opened or marked ready for review, this workflow:
  1. Checks out the code.
  2. Installs Node.js and Cline CLI.
  3. Configures authentication (e.g., Anthropic, OpenAI).
  4. Runs Cline with a comprehensive system prompt to analyze the diff, context, and related issues using GitHub CLI (gh).
  5. Posts a detailed review comment with inline code suggestions.

Prerequisites

  • GitHub repository with Actions enabled.
  • AI Provider API Key (e.g., Anthropic, OpenRouter) added as a repository secret (e.g., ANTHROPIC_API_KEY).
  • GitHub Token (automatically provided by Actions as GITHUB_TOKEN).

Setup

1. Create the Workflow File

Create a file named .github/workflows/cline-pr-review.yml in your repository:

Deep code review

Analyze the code changes. Look for:
  • Logic errors and edge cases
  • Security vulnerabilities
  • Performance issues
  • adherence to patterns in the codebase

Submit Review

Post a single comprehensive comment summarizing your review. If you have specific code suggestions, use the GitHub API to post inline comments:
Start your main comment with “Reviewed by Cline”.’
We grant pull-requests: write so Cline can post comments and inline reviews. contents: read ensures it can analyze the code but cannot push changes directly, providing a security boundary.

Authentication

The auth command configures Cline in the CI environment without interactive prompts. You can switch providers (e.g., openai, openrouter) by changing the flags.

Autonomous Mode (--auto-approve true)

The --auto-approve true flag tells Cline to run autonomously, executing approved tools without waiting for interactive confirmation. Prompt runs start in Act mode by default, so CI/CD workflows can perform the requested work immediately.

Command Permissions

We explicitly restrict what commands Cline can run using CLINE_COMMAND_PERMISSIONS. This ensures Cline can only use gh and git commands relevant to reviewing, preventing any accidental or malicious system modifications.

Customizing the Reviewer

The “System Prompt” passed to Cline in the final step is fully customizable. You can modify it to:
  • Enforce specific style guides.
  • Focus on security vs. performance.
  • Ask for specific types of feedback (e.g., “Roast my code” vs. “Be gentle”).