update doc

This commit is contained in:
caesar
2025-01-16 20:24:55 +08:00
parent 628739dac0
commit 68bae31202

188
README.md
View File

@@ -48,6 +48,7 @@ jobs:
model: 'gemma2:2b'
host: ${{ vars.OLLAMA_HOST }}
ai_token: ${{ secrets.AI_TOKEN }}
REVIEW_PULL_REQUEST: false
exclude_files: |
^.+\.md
test2\.js
@@ -68,115 +69,136 @@ result
## 输入参数
1. **repository**:
- **描述**: 要审查的代码库名称,格式为 `owner/repository`,例如 `actions/checkout`
- **默认值**: `${{ github.repository }}`
2. **BASE_REF**:
- **描述**: GitHub 事件中 Pull Request 的基线引用
- **默认值**: `${{ github.event.pull_request.base.ref }}`
1. **repository**
- **描述**: 存储库名称,格式为 `owner/repo`(例如 `actions/checkout`
- **默认值**: `${{ github.repository }}`(当前 GitHub 仓库的名称)。
3. **PULL_REQUEST_NUMBER**:
- **描述**: GitHub 事件中 Pull Request 的编号
- **默认值**: `${{ github.event.pull_request.number }}`
2. **REVIEW_PULL_REQUEST**
- **描述**: 指定是否要比较从提交开始到最新的记录;设置为 `false` 表示只审核最新一次提交
- **默认值**: `false`
4. **CHINESE**:
- **描述**: 是否使用中文进行审查
- **默认值**: `"true"`
3. **BASE_REF**
- **描述**: 当前 GitHub 事件中的 pull_request 的基准分支
- **默认值**: `${{ github.event.pull_request.base.ref }}`
5. **token**:
- **描述**: 用于获取存储库的个人访问令牌PAT。建议使用最小权限的服务帐户
- **默认值**: `${{ github.token }}`
4. **PULL_REQUEST_NUMBER**
- **描述**: 当前 GitHub 事件中的 pull_request 编号
- **默认值**: `${{ github.event.pull_request.number }}`
6. **model**:
- **描述**: 要用于代码审查的 AI 模型
- **必需**:
- **默认值**: `'gemma2:2b'`
5. **CHINESE**
- **描述**: 使用中文(作废)
- **默认值**: `""`
7. **host**:
6. **LANGUAGE**
- **描述**: 使用语言(中文)。
- **默认值**: `"Chinese"`
7. **token**
- **描述**: 用于访问存储库的个人访问令牌PAT。该令牌配置在本地 git 配置中,允许脚本运行经过身份验证的 git 命令。作业结束时会移除 PAT。
- **建议**: 使用权限最少的服务账号生成新的 PAT 并仅选择必要的作用域。
- **文档链接**: [了解如何创建和使用加密密钥](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets)。
- **默认值**: `${{ github.token }}`
8. **model**
- **描述**: 用于代码审核的 AI 模型。
- **必需**: 是。
- **默认值**: `'gemma2:2b'`
9. **host**
- **描述**: Ollama 主机地址。
- **必需**: 是
- **默认值**: `'http://127.0.0.1:11434'`
- **必需**: 是
- **默认值**: `'http://127.0.0.1:11434'`
8. **reviewers_prompt**:
- **描述**: Ollama 的系统提示。定义了代码审查的参数和预期格式
- **必需**:
- **默认值**: 一段详细的说明文本,指导审查生成过程。
10. **PROMPT_GENRE**
- **描述**: 提示生成的类型
- **默认值**: `' '`(空格)。
9. **ai_token**:
- **描述**: AI 访问令牌
- **必需**: 否
- **默认值**: `" "`
11. **reviewers_prompt**
- **描述**: Ollama 系统提示信息
- **必需**: 否
- **默认值**: `""`(空字符串)。
10. **include_files**:
- **描述**: 要包含审查的文件列表,以逗号分隔,支持换行
- **必需**: 否
- **默认值**: `" "`默认为空,不限制)
12. **ai_token**
- **描述**: AI 令牌
- **必需**: 否
- **默认值**: `" "`空格)。
11. **exclude_files**:
- **描述**: 要排除审查的文件列表,以逗号分隔,支持换行
- **必需**: 否
- **默认值**: `" "`(默认为空,不传递文件)
13. **include_files**
- **描述**: 要包括审查的文件以逗号分隔的列表
- **必需**: 否
- **默认值**: `" "`(默认为空,表示不限制)。
14. **exclude_files**
- **描述**: 要排除审查的文件的以逗号分隔的列表。
- **必需**: 否。
- **默认值**: `" "`(默认为空,表示不传递文件)。
12. **PROMPT_GENRE**:
- **描述**: 提示模式类型。
- **必需**: 否
- **默认值**: `" "`(默认为空)
### Input Parameters
1. **repository**:
- **Description**: The name of the repository to review, formatted as `owner/repository`, for example, `actions/checkout`.
- **Default Value**: `${{ github.repository }}`
1. **repository**
- **Description**: The name of the repository, formatted as `owner/repo` (e.g., `actions/checkout`).
- **Default Value**: `${{ github.repository }}` (the name of the current GitHub repository).
2. **BASE_REF**:
- **Description**: The base reference of the Pull Request in the GitHub event.
- **Default Value**: `${{ github.event.pull_request.base.ref }}`
2. **REVIEW_PULL_REQUEST**
- **Description**: Specifies whether to compare the records from the beginning of the commit to the latest one; setting it to `false` means that only the most recent commit will be reviewed.
- **Default Value**: `false`.
3. **PULL_REQUEST_NUMBER**:
- **Description**: The number of the Pull Request in the GitHub event.
- **Default Value**: `${{ github.event.pull_request.number }}`
3. **BASE_REF**
- **Description**: The base branch of the pull request in the current GitHub event.
- **Default Value**: `${{ github.event.pull_request.base.ref }}`.
4. **CHINESE**:
- **Description**: Whether to use Chinese for the review.
- **Default Value**: `"true"`
4. **PULL_REQUEST_NUMBER**
- **Description**: The number of the pull request in the current GitHub event.
- **Default Value**: `${{ github.event.pull_request.number }}`.
5. **token**:
- **Description**: A Personal Access Token (PAT) used to access the repository. It is recommended to use a service account with the least necessary permissions.
- **Default Value**: `${{ github.token }}`
5. **CHINESE**
- **Description**: Use Chinese (deprecated).
- **Default Value**: `""`.
6. **model**:
- **Description**: The AI model to use for the code review.
- **Required**: Yes
- **Default Value**: `'gemma2:2b'`
6. **LANGUAGE**
- **Description**: Language to use (Chinese).
- **Default Value**: `"Chinese"`.
7. **host**:
- **Description**: The Ollama host address.
- **Required**: Yes
- **Default Value**: `'http://127.0.0.1:11434'`
7. **token**
- **Description**: Personal access token (PAT) used to access the repository. The PAT is configured in the local git configuration, allowing your scripts to run authenticated git commands. The PAT will be removed at the end of the job.
- **Recommendation**: Use a service account with the least permissions necessary when generating a new PAT and select only the minimum required scopes.
- **Documentation Link**: [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets).
- **Default Value**: `${{ github.token }}`.
8. **reviewers_prompt**:
- **Description**: Ollama's system prompt. It defines the parameters and expected format for the code review.
- **Required**: No
- **Default Value**: A detailed description text guiding the review generation process.
8. **model**
- **Description**: AI model to use for code review.
- **Required**: Yes.
- **Default Value**: `'gemma2:2b'`.
9. **ai_token**:
- **Description**: The AI access token.
- **Required**: No
- **Default Value**: `" "`
9. **host**
- **Description**: Ollama host address.
- **Required**: Yes.
- **Default Value**: `'http://127.0.0.1:11434'`.
10. **include_files**:
10. **PROMPT_GENRE**
- **Description**: The genre of the prompt to generate.
- **Default Value**: `' '` (space).
11. **reviewers_prompt**
- **Description**: Ollama system prompt.
- **Required**: No.
- **Default Value**: `""` (empty string).
12. **ai_token**
- **Description**: AI token.
- **Required**: No.
- **Default Value**: `" "` (space).
13. **include_files**
- **Description**: A comma-separated list of files to include in the review.
- **Required**: No
- **Default Value**: `" "` (empty by default, no restrictions)
- **Required**: No.
- **Default Value**: `" "` (defaults to empty, meaning no restrictions).
11. **exclude_files**:
14. **exclude_files**
- **Description**: A comma-separated list of files to exclude from the review.
- **Required**: No
- **Default Value**: `" "` (empty by default, no files passed)
- **Required**: No.
- **Default Value**: `" "` (defaults to empty, meaning no files passed).
12. **PROMPT_GENRE**:
- **描述**: prompt genre
- **必需**: No
- **默认值**: `" "` (empty by default)