Gitea 1.18 功能前瞻:创建工单、合并请求时启用表单和校验
对于开发来说,我们在收到开发工单时希望有完整的需求描述、错误日志以及问题复现方法。为了帮助提问者讲清楚他们的需求,Gitea 在新版本中推出表单和校验功能。
在最新的 dev
分支中,Gitea 的议题模板功能得到增强,用户不仅可以使用传统的 Markdown 模板创建工单与合并请求,还可以使用 YAML 模板创建预格式化的问卷调查清单。同时,1.18-rc1
将于 9 月中旬发布!
模板介绍
Gitea 支持两种格式的模板,Markdown 和 YAML。
Markdown 模板
在 Gitea 中存在两种用途的 Markdown 模板:
ISSUE_TEMPLATE/bug-report.md
用于规范工单的 Markdown 文本描述PULL_REQUEST_TEMPLATE.md
用于规范合并请求的 Markdown 文本描述
对于以上 Markdown 模板,我们推荐您将它们放置到项目目录 .gitea
进行收纳。
YAML 模板
用 YAML 语法编写的模板相比 Markdown 可以实现更丰富的功能,利用表单实现诸如:问卷调查、字符校验。在 Gitea 中的 YAML 同样支持两种用途:
ISSUE_TEMPLATE/bug-report.yaml
用于创建问卷调查形式的工单PULL_REQUEST_TEMPLATE.yaml
用于创建表单形式的合并请求
对于以上 YAML 模板,我们同样推荐您将它们放置到项目目录 .gitea
进行收纳。
表单支持通过 URL 查询参数传值
当新建工单页面 URL 以 ?title=Issue+Title&body=Issue+Text
为查询参数,表单将使用其中的参数(key-value)填充表单内容。
Gitea 支持的模板文件路径
工单模板文件名:
ISSUE_TEMPLATE.md
ISSUE_TEMPLATE.yaml
ISSUE_TEMPLATE.yml
issue_template.md
issue_template.yaml
issue_template.yml
.gitea/ISSUE_TEMPLATE.md
.gitea/ISSUE_TEMPLATE.yaml
.gitea/ISSUE_TEMPLATE.yml
.gitea/issue_template.md
.gitea/issue_template.yaml
.gitea/issue_template.yml
.github/ISSUE_TEMPLATE.md
.github/ISSUE_TEMPLATE.yaml
.github/ISSUE_TEMPLATE.yml
.github/issue_template.md
.github/issue_template.yaml
.github/issue_template.yml
合并请求模板:
PULL_REQUEST_TEMPLATE.md
PULL_REQUEST_TEMPLATE.yaml
PULL_REQUEST_TEMPLATE.yml
pull_request_template.md
pull_request_template.yaml
pull_request_template.yml
.gitea/PULL_REQUEST_TEMPLATE.md
.gitea/PULL_REQUEST_TEMPLATE.yaml
.gitea/PULL_REQUEST_TEMPLATE.yml
.gitea/pull_request_template.md
.gitea/pull_request_template.yaml
.gitea/pull_request_template.yml
.github/PULL_REQUEST_TEMPLATE.md
.github/PULL_REQUEST_TEMPLATE.yaml
.github/PULL_REQUEST_TEMPLATE.yml
.github/pull_request_template.md
.github/pull_request_template.yaml
.github/pull_request_template.yml
工单模板目录
由于工单存在多种类型,Gitea 支持将工单模板统一收纳到 ISSUE_TEMPLATE
目录。以下是 Gitea 支持的工单模板目录:
ISSUE_TEMPLATE
issue_template
.gitea/ISSUE_TEMPLATE
.gitea/issue_template
.github/ISSUE_TEMPLATE