forked from forgejo/forgejo
Ignore issue template with a special name (#21830)
A file in `ISSUE_TEMPLATE` with the name `config.yml` shouldn't be treated as a YAML template, it's for [configuring the template chooser](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser). The old code tried to ignore the file, but it didn't work, caused by #20987. That's why the warning is displayed: <img width="415" alt="image" src="https://user-images.githubusercontent.com/9418365/202094067-804c42fe-0e9e-4fc5-bf01-d95fa336f54f.png"> Note that this PR is not an implementation of `config.yml`, there will be another one to do it.
This commit is contained in:
parent
f311d15a0b
commit
92dd24716d
2 changed files with 46 additions and 3 deletions
|
@ -5,7 +5,7 @@
|
|||
package structs
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"path"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -163,11 +163,11 @@ const (
|
|||
|
||||
// Type returns the type of IssueTemplate, can be "md", "yaml" or empty for known
|
||||
func (it IssueTemplate) Type() IssueTemplateType {
|
||||
if it.Name == "config.yaml" || it.Name == "config.yml" {
|
||||
if base := path.Base(it.FileName); base == "config.yaml" || base == "config.yml" {
|
||||
// ignore config.yaml which is a special configuration file
|
||||
return ""
|
||||
}
|
||||
if ext := filepath.Ext(it.FileName); ext == ".md" {
|
||||
if ext := path.Ext(it.FileName); ext == ".md" {
|
||||
return IssueTemplateTypeMarkdown
|
||||
} else if ext == ".yaml" || ext == ".yml" {
|
||||
return IssueTemplateTypeYaml
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue