
Configure authentication
Set up your API key and repository secrets to authenticate Cursor CLI in GitHub Actions.Set up agent permissions
Create a configuration file to control what actions the agent can perform. This prevents unintended operations like pushing code or creating pull requests. Create.cursor/cli.json in your repository root:
Build the GitHub Actions workflow
Now let’s build the workflow step by step.Set up the workflow trigger
Create.github/workflows/cursor-code-review.yml and configure it to run on pull requests:
Checkout the repository
Add the checkout step to access the pull request code:Install Cursor CLI
Add the CLI installation step:Configure the review agent
Before implementing the full review step, let’s understand the anatomy of our review prompt. This section outlines how we want the agent to behave: Objective: We want the agent to review the current PR diff and flag only clear, high-severity issues, then leave very short inline comments (1-2 sentences) on changed lines only with a brief summary at the end. This keeps the signal-to-noise ratio balanced. Format: We want comments that are short and to the point. We use emojis to make scanning comments easier, and we want a high-level summary of the full review at the end. Submission: When the review is done, we want the agent to include a short comment based on what was found during the review. The agent should submit one review containing inline comments plus a concise summary. Edge cases: We need to handle:- Existing comments being resolved: The agent should mark them as done when addressed
- Avoid duplicates: The agent should skip commenting if similar feedback already exists on or near the same lines
Test your reviewer
Create a test pull request to verify the workflow works and the agent posts review comments with emoji feedback.
Next steps
You now have a working automated code review system. Consider these enhancements:- Set up additional workflows for fixing CI failures
- Configure different review levels for different branches
- Integrate with your team’s existing code review process
- Customize the agent’s behavior for different file types or directories