Note
问题表单目前为 beta 版本,可能随时更改。
关于议题表单的 YAML 语法
可以通过将 YAML 表单定义文件添加到存储库中的 /.github/ISSUE_TEMPLATE
文件夹来创建自定义问题表单。 如果你不熟悉 YAML 并且想要了解详细信息,请参阅“在五分钟内了解 YAML”。 您可以为议题表单定义不同的输入类型、验证、默认受理人和默认标签。
当贡献者填写议题表单时,他们对每个输入的响应都会转换为 Markdown 并添加到议题正文中。 贡献者可以编辑使用议题表单创建的议题,其他人可以与议题(如通过其他方法创建的议题)进行交互。
拉取请求不支持议题表单。 您可以在存储库中创建拉取请求模板,供协作者使用。 有关详细信息,请参阅“为仓库创建拉取请求模板”。
此示例 YAML 配置文件使用多个输入报告漏洞来定义议题表单。
Note
required
字段键仅在公共存储库中受支持。 在专用存储库和内部存储库中,所有字段都是可选的。
name: Bug Report description: File a bug report. title: "[Bug]: " labels: ["bug", "triage"] assignees: - octocat body: - type: markdown attributes: value: | Thanks for taking the time to fill out this bug report! - type: input id: contact attributes: label: Contact Details description: How can we get in touch with you if we need more info? placeholder: ex. email@example.com validations: required: false - type: textarea id: what-happened attributes: label: What happened? description: Also tell us, what did you expect to happen? placeholder: Tell us what you see! value: "A bug happened!" validations: required: true - type: dropdown id: version attributes: label: Version description: What version of our software are you running? options: - 1.0.2 (Default) - 1.0.3 (Edge) validations: required: true - type: dropdown id: browsers attributes: label: What browsers are you seeing the problem on? multiple: true options: - Firefox - Chrome - Safari - Microsoft Edge - type: textarea id: logs attributes: label: Relevant log output description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. render: shell - type: checkboxes id: terms attributes: label: Code of Conduct description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com). options: - label: I agree to follow this project's Code of Conduct required: true
name: Bug Report
description: File a bug report.
title: "[Bug]: "
labels: ["bug", "triage"]
assignees:
- octocat
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: ex. email@example.com
validations:
required: false
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
value: "A bug happened!"
validations:
required: true
- type: dropdown
id: version
attributes:
label: Version
description: What version of our software are you running?
options:
- 1.0.2 (Default)
- 1.0.3 (Edge)
validations:
required: true
- type: dropdown
id: browsers
attributes:
label: What browsers are you seeing the problem on?
multiple: true
options:
- Firefox
- Chrome
- Safari
- Microsoft Edge
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com).
options:
- label: I agree to follow this project's Code of Conduct
required: true
顶级语法
所有问题表单配置文件都必须以 name
、description
和 body
键值对开头。
name: description: body:
name:
description:
body:
您可以为每个议题表单设置以下顶级键。
密钥 | 说明 | 必需 | 类型 |
---|---|---|---|
name | 议题表单模板的名称。 必须与所有其他模板不同,包括 Markdown 模板。 | 必须 | String |
description | 议题表单模板的描述,出现在模板选择器界面中。 | 必须 | String |
body | 表单中输入类型的定义。 | 必需 | 数组 |
assignees | 将自动分配给使用此模板创建的议题的人员。 | 可选 | 阵列或逗号分界的字符串 |
labels | 将自动添加到此模板创建的议题的标签。 如果标签尚未存在于存储库中,则不会将其自动添加到问题中。 | 可选 | 阵列或逗号分界的字符串 |
title | 在议题提交表单中预填的默认标题。 | 可选 | 字符串 |
有关可用的 body
输入类型及其语法,请参阅“GitHub 表单架构的语法”。
将 Markdown 议题模板转换为 YAML 议题表单模板
您可以在仓库中同时使用 Markdown 和 YAML议题模板。 如果您想将 Markdown 议题模板转换为 YAML 议题表模板, 您必须创建一个新的 YAML 文件来定义议题表单。 您可以手动将现有的 Markdown 议题模板转换为 YAML 议题表单。 有关详细信息,请参阅“为仓库配置议题模板”。
如果您想要对 YAML 议题表单使用相同的文件名称,则在将新文件提交到仓库时,您必须删除 Markdown 议题模板。
下面是 Markdown 议题模板和相应的 YAML 议题表单模板示例。
Markdown 议题模板
--- name: 🐞 Bug about: File a bug/issue title: '[BUG] <title>' labels: Bug, Needs Triage assignees: '' --- <!-- Note: Please search to see if an issue already exists for the bug you encountered. --> ### Current Behavior: <!-- A concise description of what you're experiencing. --> ### Expected Behavior: <!-- A concise description of what you expected to happen. --> ### Steps To Reproduce: <!-- Example: steps to reproduce the behavior: 1. In this environment... 1. With this config... 1. Run '...' 1. See error... --> ### Environment: <!-- Example: - OS: Ubuntu 20.04 - Node: 13.14.0 - npm: 7.6.3 --> ### Anything else: <!-- Links? References? Anything that will give us more context about the issue that you are encountering! -->
---
name: 🐞 Bug
about: File a bug/issue
title: '[BUG] <title>'
labels: Bug, Needs Triage
assignees: ''
---
<!--
Note: Please search to see if an issue already exists for the bug you encountered.
-->
### Current Behavior:
<!-- A concise description of what you're experiencing. -->
### Expected Behavior:
<!-- A concise description of what you expected to happen. -->
### Steps To Reproduce:
<!--
Example: steps to reproduce the behavior:
1. In this environment...
1. With this config...
1. Run '...'
1. See error...
-->
### Environment:
<!--
Example:
- OS: Ubuntu 20.04
- Node: 13.14.0
- npm: 7.6.3
-->
### Anything else:
<!--
Links? References? Anything that will give us more context about the issue that you are encountering!
-->
YAML 议题表单模板
name: 🐞 Bug description: File a bug/issue title: "[BUG] <title>" labels: ["Bug", "Needs Triage"] body: - type: checkboxes attributes: label: Is there an existing issue for this? description: Please search to see if an issue already exists for the bug you encountered. options: - label: I have searched the existing issues required: true - type: textarea attributes: label: Current Behavior description: A concise description of what you're experiencing. validations: required: false - type: textarea attributes: label: Expected Behavior description: A concise description of what you expected to happen. validations: required: false - type: textarea attributes: label: Steps To Reproduce description: Steps to reproduce the behavior. placeholder: | 1. In this environment... 1. With this config... 1. Run '...' 1. See error... validations: required: false - type: textarea attributes: label: Environment description: | examples: - **OS**: Ubuntu 20.04 - **Node**: 13.14.0 - **npm**: 7.6.3 value: | - OS: - Node: - npm: render: markdown validations: required: false - type: textarea attributes: label: Anything else? description: | Links? References? Anything that will give us more context about the issue you are encountering! Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. validations: required: false
name: 🐞 Bug
description: File a bug/issue
title: "[BUG] <title>"
labels: ["Bug", "Needs Triage"]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Current Behavior
description: A concise description of what you're experiencing.
validations:
required: false
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: false
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
1. With this config...
1. Run '...'
1. See error...
validations:
required: false
- type: textarea
attributes:
label: Environment
description: |
examples:
- **OS**: Ubuntu 20.04
- **Node**: 13.14.0
- **npm**: 7.6.3
value: |
- OS:
- Node:
- npm:
render: markdown
validations:
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false