建议使用查询参数。
正如《关于 PR 模板》中提到的:
您必须在存储库的默认分支上创建模板。
在其他分支创建的模板不可供协作者使用。
最近(2021 年以上)可用的另一种方法是使用 GitHub Action,例如actions/pull-request-updater-github-action,它可以使用从分支名称中提取的信息更新拉取请求。
name: "Update Pull Request"
on: pull_request
jobs:
update_pr:
runs-on: ubuntu-latest
steps:
- uses: tzkhan/pr-update-action@v2
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
base-branch-regex: '[a-z\d-_.\\/]+'
head-branch-regex: 'foo-\d+'
title-template: '[%headbranch%] '
body-template: |
Merging into '%basebranch%'
[Link to %headbranch%](https://url/to/browse/ticket/%headbranch%)
body-update-action: 'suffix'
body-uppercase-base-match: false
Run Code Online (Sandbox Code Playgroud)
这并不完全是每个分支的模板,但您可以分叉此操作并修改它,以便为每个分支查找模板文件,并用它替换 PR 的正文。
| 归档时间: |
|
| 查看次数: |
1768 次 |
| 最近记录: |