文章版本: Enterprise Server 2.17
手动为仓库创建单一议题模板
将手动创建的议题模板添加到仓库后,项目贡献者会自动在议题正文中看到模板的内容。
这是用于创建议题模板的旧工作流程。 建议使用升级的多议题模板构建器来创建多个议题模板。 更多信息请参阅“关于议题和拉取请求模板”。
您可以在任何支持的文件夹中创建 ISSUE_TEMPLATE/ 子目录,以包含多个议题模板,并且使用 template 查询参数指定填充议题正文的模板。 更多信息请参阅“关于使用查询参数自动化议题和拉取请求”。
You can add YAML frontmatter to each issue template to pre-fill the issue title, automatically add labels and assignees, and give the template a name and description that will be shown in the template chooser that people see when creating a new issue in your repository.
Here is example YAML front matter.
---
name: Tracking issue
about: Use this template for tracking new features.
title: "[DATE]: [FEATURE NAME]"
labels: tracking issue, needs triage
assignees: octocat
---
Note: You must put YAML-reserved characters such as : in quotes. For example, ":bug: Bug".
您可以创建默认的议题模板,适用于您的组织。 更多信息请参阅“创建默认社区健康文件”。
添加议题模板
- 在 GitHub Enterprise 上,导航到仓库的主页面。
- 在文件列表上方,单击 Create new file(创建新文件)。  
- 在文件名字段中:- 要使议题模板显示在仓库的根目录中,请输入 issue_template 的名称。 例如 issue_template.md。 
- To make your issue template visible in the repository's docsdirectory, type docs/ followed by the name of your issue_template. 例如docs/issue_template.md。 
- 要将文件存储在隐藏的目录中,请输入 .github/,后接 issue_template 的名称。 例如 .github/issue_template.md。 
- 要创建多个议题模板,并使用 template查询参数指定填充议题正文的模板,请输入 .github/ISSUE_TEMPLATE/,后接议题模板的名称。 例如.github/ISSUE_TEMPLATE/issue_template.md。 您也可以在根目录或docs/目录的ISSUE_TEMPLATE子目录中存储多个议题模板。 更多信息请参阅“关于使用查询参数自动化议题和拉取请求”。 
 
- 要使议题模板显示在仓库的根目录中,请输入 issue_template 的名称。 例如 
- 在新文件的正文中,添加您的议题模板。 这可能包括:- YAML frontmatter
- Expected behavior and actual behavior
- Steps to reproduce the problem
- Specifications like the version of the project, operating system, or hardware
 
- 在页面底部,输入一条简短、有意义的提交消息,描述您对文件所作的更改。 您可以在提交消息中将提交归于多个作者。 更多信息请参阅“创建有多个合作作者的提交”。  
- 在提交消息字段下面,确定是要将提交添加到当前分支还是新分支。 如果当前分支是 master,则应选择为提交创建新分支,然后创建拉取请求。 更多信息请参阅“创建新的拉取请求”。 Templates are available to collaborators when they are merged into the repository's default branch. Templates are available to collaborators when they are merged into the repository's default branch.
- 单击 Propose new file(提议新文件)。 