尽管@VonC's answer 是正确的,GitHub 对问题模板的集成已经改进,所以我将总结当前的方式:
简单(新)方法
在存储库的主要设置中,单击 问题 功能元素中标有 开始模板设置 的绿色按钮。
然后,只需按照 GitHub 提供的说明添加、命名和编辑问题模板。
这些模板随后将作为 Markdown 文件添加到项目根目录中的 .github/ISSUE_TEMPLATE/ 目录中。
然后,您可以决定是直接在 IDE/文本编辑器中编辑它们,还是直接在 GitHub 中以与上述相同的方式进行编辑。
如果您更喜欢official, pictured guide,请随意使用它。 ;-)
手动(旧)方式
和@VonC explained一样,只需在.github/ISSUE_TEMPLATE/目录下添加一些markdown文件即可。您可以通过将 ?template=filename.md 添加到新问题 URL 来引用它们。
我建议使用带有可用模板列表的标准模板 (.github/ISSUE_TEMPLATE.md),例如:
Please switch to **Preview** and select one of the following links:
* [Feature](?template=feature.md)
* [Bug](?template=bug.md)
Once switched to the correct template, you can save the link as a bookmark. Keep in mind that switching templates will remove all already entered data within this issue.
这允许只需单击两次即可获得所需的模板,而不是复制和粘贴。
比较
新方法生成的文件与手动(旧)方法生成的文件之间的唯一区别是顶部有一个小表格,其中包含每个模板的名称和描述。
您只需在顶部添加以下几行即可轻松转换现有文件:
---
name: Bug report
about: Use this one for existing problems in the STN, which shouldn't be there.
---
我更喜欢新方式,因为它只是旧方式的包装,您仍然可以使用它的所有功能,例如带有 ?template=filename.md 的书签以及通过 IDE 和文本编辑器进行编辑。