Github 拉取请求模板使用 config.yml 检测 YAML 前端内容并应用于字段

Github pull request template detect YAML front matter using config.yml and apply to fields

我希望在 GitHub 中创建一个拉取请求模板,其中 Github 能够获取类似于 Issue_templates 的 YAML 前端内容并将其解析为正确的字段。 在 Supported file types 下的 Github 文档中 => config.yml 它声称允许拉取请求模板配置。

GitHub Docs 如下例:


---
name: Name of pull request template 
about: "Use this template for setting up your PR description"
title: "Add support for the new feature"
labels: bug, enhancement, customer-request
assignees: self
---

唯一相关的信息是将键作为查询参数传递以显示多个模板之一,请参阅下面的 link。

文档:

亲自测试后,GitHub 目前似乎没有解析 Pull Request 模板的 YAML 前端内容。您可以拥有一个默认模板 pull_request_template.md,并在 PULL_REQUEST_TEMPLATE/ 中使用 GET 查询 template= 访问自定义模板。然而,在这两种情况下,前面的内容块将显示为正文的一部分,而不是被解析。

文档对此不是很清楚,但是config.yml只能用于configure the issue template chooser。目前没有pull request template chooser配置。

您可以使用社区论坛上的 contact support form, and selecting Pull requests and code review for the What part of GitHub is your feedback about? option. That is according to this answer 提交功能请求。

与此同时,解决此问题的一种方法可能是在您的默认 (pull_request_template.md) 中留言,例如指向您的 CONTRIBUTING.md。然后,在该文件中,您可以为每种类型的带有自定义 GET 查询的拉取请求包含 links。例如,对于 PULL_REQUEST_TEMPLATE/custom.md,link 可能是(url 为了方便而分解):

https://github.com/<user>/<repo>/compare/<base>...<compare>?
template=custom.md
&title=Add+support+for+the+new+feature
&labels=bug%2Cenhancement%2Ccustomer-request
&assignees=self

根据 supported query params.

经过反复试验,您目前无法使用 YAML front matter。 唯一的方法是使用 URL.

中的查询参数
https://github.com/url/to/pr?
template=custom_template_pr.md
&title=Add+support+for+the+new+feature
&labels=bug%2Cenhancement%2Ccustomer-request
&assignees=self