Supports four types of operations using AI: code review, PR title and description readability check, commit message readability check, and change summary.
Note: Results are for reference only and are not recommended as final criteria.
cnbcool/ai-review
type: Operation type, default is code-review
code-review: Code reviewpr-info-readability-check: PR title and description readability checkcommit-message-readability-check: Commit message readability checkdiff-summary: Change summarymessage: When type=commit-message-readability-check, you can specify the message parameter to indicate the commit message. If not specified, it defaults to CNB_COMMIT_MESSAGEpr_comment: true or false, default is true. Whether to post PR comments as pull_request inline comments. Valid when type=code-review.max_comments: Maximum number of comments, maximum is 10. Valid when type=code-review. Both max_comments and score_for_add_comment parameters are set, both are valid. Neither is set, a comment will be posted by default.prompt_output_file: Optional, relative file path, such as ./prompt.txt. If provided, the prompt will be saved to the file.result_output_file: Optional, relative file path, such as ./result.txt. If provided, the AI output result will be saved to the file.score_for_add_comment: Optional, when type=code-review and pr_comment is true, you can specify this parameter to indicate the comment score threshold. Reviews below this score will be commented on the PR. Both max_comments and score_for_add_comment parameters are set, both are valid. Neither is set, a comment will be posted by default.ai_chat_url: Optional, AI chat service address. For example https://ai.xxx.com/chat/completions. If not specified, the AI service provided by CNB will be used by default.ai_token: Optional, AI chat service token. If not specified, the AI service token provided by CNB will be used by default.ai_model: Optional, AI chat service model. If not specified, the AI service model provided by CNB will be used by default.pr-info-readability-check: Outputs environment variable name status, value is yes or nocommit-message-readability-check: Outputs environment variable name status, value is yes or nodiff-summary: Outputs environment variable name summary, indicating the content of the change summaryBy default, AI review comments will be sent as comments to the PR. Currently only supports sending one comment.
main:
pull_request:
- stages:
- name: Code Review
image: cnbcool/ai-review:latest
settings:
type: code-review
main:
pull_request:
- stages:
- name: Title and Description Readability Check
image: cnbcool/ai-review:latest
settings:
type: pr-info-readability-check
exports:
status: STATUS
- name: Title and Description Readability Check Result
script: echo $STATUS
main:
push:
- stages:
- name: Commit Message Readability Check
image: cnbcool/ai-review:latest
settings:
type: commit-message-readability-check
exports:
status: STATUS
- name: Commit Message Readability Check Result
script: echo $STATUS
main:
pull_request:
- stages:
- name: Change Summary
image: cnbcool/ai-review:latest
settings:
type: diff-summary
exports:
summary: SUMMARY
- name: Change Summary
script: echo $SUMMARY