GitHub 允许创建 PR 模板。是否可以做同样的事情,但是对于拉取请求评论?
这样的一个例子是添加审核清单,如下所示:
- [] Have all the GitHub checks passed?
- [] Is there any redundant code?
- [] Could any optimization be applied?
在 GitHub 中,没有用于拉取请求审核的模板,但您可以在草稿 PR 更改为
ready for review
状态时运行 GitHub 操作,例如:
on:
pull_request_target:
types:
- ready_for_review
要在此步骤中创建带有复选框的评论,请使用 marocchino/sticky-pull-request-comment。我已经在这个 PR 中对其进行了测试,我对它的效果感到非常兴奋。
完整示例:
name: "Pull request checklist"
on:
pull_request_target:
types:
- ready_for_review
jobs:
pull_request_info:
runs-on: ubuntu-latest
steps:
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_HEAD_REF})"
id: extract_branch
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Show checklist
uses: marocchino/sticky-pull-request-comment@v2
with:
header: show_checklist
message: |
- [ ] Checklist item 1
- [ ] Checklist item 2
欲了解更多选项,请查看: