zai-code-review is a tool that uses Z.ai models to perform AI-driven code review of GitHub Pull Requests. It is integrated into repositories through GitHub Actions and can automatically comment on PRs, detect bugs, and provide improvement suggestions.
Main capabilities:
- Provide AI-driven PR feedback
- Detect bugs
- Provide improvement suggestions
- Automatically post PR comments
- Work with GitHub Actions
How to use: Add the configuration to .github/workflows/code-review.yml. When using it, you must add the Z.ai API key as a GitHub Secret.
- Get a Z.ai API key: Generate an API key from the Z.ai dashboard.
- Add the API key to the repository: Go to the GitHub repository, navigate to Secrets and variables → Actions, click New repository secret and add: Name as ZAI_API_KEY, Value as your Z.ai API key.
The default system prompt is: You are an expert code reviewer. Review the provided code changes and give clear, actionable feedback.
You can override the default prompt to focus on specific concerns, enforce coding standards, or adjust the review tone, for example: You are a security-focused code reviewer. Identify vulnerabilities, unsafe patterns, and authentication issues. Skip style comments.
Advanced configuration: You can override the default values of ZAI_MODEL, ZAI_SYSTEM_PROMPT, and ZAI_REVIEWER_NAME instead of using them, and manage them as GitHub Actions variables. This allows you to update the model, review prompt, or reviewer name without modifying the workflow file.
- Add variables to the repository: Click the Variables tab, click New repository variable and add: Name as ZAI_MODEL, Value such as glm-4.7; Name as ZAI_SYSTEM_PROMPT, Value as your custom system prompt; Name as ZAI_REVIEWER_NAME, Value such as AI Code Review.
- Reference them in the workflow.
This project is licensed under the MIT License. Contributions are welcome.