gpt4 book ai didi

特定分支的 Github 拉取请求模板

转载 作者:行者123 更新时间:2023-12-01 19:52:15 25 4
gpt4 key购买 nike

是否可以为特定分支分配拉取请求模板?使用查询参数是唯一的解决方法吗?

最佳答案

Query parameters推荐。

如“About PR templates”中所述:

You must create templates on the repository's default branch.
Templates created in other branches are not available for collaborators to use.

<小时/>

最近(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

https://github.com/tzkhan/pr-update-action/raw/master/img/pr-after.png

不完全是每个分支的模板,但您可以 fork 此操作并修改它,以便为每个分支查找模板文件,并用它替换 PR 的正文。

关于特定分支的 Github 拉取请求模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51698118/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com