feat: search in the docs directory for issue and pull request templates (#8863)

For pull request templates, Forgejo currently does not look in the `docs` directory, but [GitHub does](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository#adding-a-pull-request-template). By making Forgejo also look there, it becomes possible to have the same repository work on both sites, without the need for vendor-specific paths.

There was duplication in the list of accepted file paths. On the one hand it’s nice for greppability that they are all spelled out, but it does mean adding 6 variants, I thought it would be more maintainable to deduplicate the Cartesian product. I added one fully spelled out path in the comment to still maintain some greppability.

Resolves forgejo/forgejo#8284

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8863
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Ruud van Asseldonk <dev@veniogames.com>
Co-committed-by: Ruud van Asseldonk <dev@veniogames.com>
This commit is contained in:
Ruud van Asseldonk 2025-08-26 22:08:10 +02:00 committed by Gusted
commit 995dba14ec
6 changed files with 50 additions and 54 deletions

View file

@ -133,6 +133,7 @@ func TestAPIRepoIssueConfigPaths(t *testing.T) {
".gitea/issue_template/config",
".github/ISSUE_TEMPLATE/config",
".github/issue_template/config",
"docs/issue_template/config",
}
for _, candidate := range templateConfigCandidates {
@ -184,7 +185,7 @@ func TestAPIRepoValidateIssueConfig(t *testing.T) {
})
t.Run("Invalid", func(t *testing.T) {
dirs := []string{".gitea", ".forgejo"}
dirs := []string{".gitea", ".forgejo", "docs"}
for _, dir := range dirs {
t.Run(dir, func(t *testing.T) {
defer tests.PrintCurrentTest(t)()