From dd673f9a168f082e858eb9bff551e9e9bb66b2a0 Mon Sep 17 00:00:00 2001 From: Gregor Sturm Date: Mon, 8 Jun 2026 17:33:32 +0200 Subject: [PATCH 1/3] Let users choose between issue labels and issue types (#492) GitHub issue types are only available to repositories owned by an organization that has the feature enabled. Repositories without it (personal accounts, or orgs that disabled the public preview) get a broken issue template, since the `type:` key is rejected. Add a cookiecutter `issue_categorization` prompt to choose between `labels` (the portable default) and `issue types`, and render the bug_report/feature_request templates accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) --- cookiecutter.json | 7 ++++++- scripts/tests/test_build.py | 19 +++++++++++++++++++ .../.github/ISSUE_TEMPLATE/bug_report.yml | 4 ++++ .../ISSUE_TEMPLATE/feature_request.yml | 4 ++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/cookiecutter.json b/cookiecutter.json index e6d37188..2403dad0 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -15,6 +15,10 @@ "Unlicense" ], "ide_integration": true, + "issue_categorization": [ + "labels", + "issue types" + ], "_copy_without_render": [ ".github/workflows/build.yaml", ".github/workflows/test.yaml", @@ -45,6 +49,7 @@ "author_email": "The e-mail address your package’s users can contact you under", "github_user": "The GitHub username or org the project is to be published under", "github_repo": "If the repo name should differ from the project name, edit it now", - "ide_integration": "Whether to generate IDE configuration files" + "ide_integration": "Whether to generate IDE configuration files", + "issue_categorization": "How to categorize issues in the issue templates. Choose “issue types” only if your GitHub organization has issue types enabled (https://docs.github.com/en/issues/tracking-your-work-with-issues/configuring-issues/managing-issue-types-in-an-organization); otherwise choose “labels”" } } diff --git a/scripts/tests/test_build.py b/scripts/tests/test_build.py index daa87f9e..e17acba4 100644 --- a/scripts/tests/test_build.py +++ b/scripts/tests/test_build.py @@ -22,6 +22,25 @@ pytest.param({"github_repo": "floob"}, "docs/conf.py", r'"github_repo": "floob",', id="gh_repo"), pytest.param({}, ".vscode/extensions.json", r'"ms-python.python",', id="no_ide_integ"), pytest.param({"ide_integration": False}, ".vscode", None, id="ide_integ"), + pytest.param({}, ".github/ISSUE_TEMPLATE/bug_report.yml", r"^labels: bug$", id="default_labels"), + pytest.param( + {"issue_categorization": "labels"}, + ".github/ISSUE_TEMPLATE/feature_request.yml", + r"^labels: enhancement$", + id="labels", + ), + pytest.param( + {"issue_categorization": "issue types"}, + ".github/ISSUE_TEMPLATE/bug_report.yml", + r"^type: Bug$", + id="issue_types_bug", + ), + pytest.param( + {"issue_categorization": "issue types"}, + ".github/ISSUE_TEMPLATE/feature_request.yml", + r"^type: Enhancement$", + id="issue_types_feature", + ), ], ) def test_build(tmp_path: Path, params: Mapping[str, Any], path: Path | str, pattern: re.Pattern | str | None) -> None: diff --git a/{{cookiecutter.project_name}}/.github/ISSUE_TEMPLATE/bug_report.yml b/{{cookiecutter.project_name}}/.github/ISSUE_TEMPLATE/bug_report.yml index 6104b9e6..aee13650 100644 --- a/{{cookiecutter.project_name}}/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/{{cookiecutter.project_name}}/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,6 +1,10 @@ name: Bug report description: Report something that is broken or incorrect +{% if cookiecutter.issue_categorization == "issue types" %} type: Bug +{% else %} +labels: bug +{% endif %} body: - type: markdown attributes: diff --git a/{{cookiecutter.project_name}}/.github/ISSUE_TEMPLATE/feature_request.yml b/{{cookiecutter.project_name}}/.github/ISSUE_TEMPLATE/feature_request.yml index c0f52a9d..3ee69f5d 100644 --- a/{{cookiecutter.project_name}}/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/{{cookiecutter.project_name}}/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,6 +1,10 @@ name: Feature request description: Propose a new feature for {{ cookiecutter.project_name }} +{% if cookiecutter.issue_categorization == "issue types" %} type: Enhancement +{% else %} +labels: enhancement +{% endif %} body: - type: textarea id: description From 0fe79e130b136c2f100792582b2d1bba728a7500 Mon Sep 17 00:00:00 2001 From: Gregor Sturm Date: Mon, 8 Jun 2026 17:42:35 +0200 Subject: [PATCH 2/3] update question text --- cookiecutter.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cookiecutter.json b/cookiecutter.json index 2403dad0..d9f83864 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -50,6 +50,6 @@ "github_user": "The GitHub username or org the project is to be published under", "github_repo": "If the repo name should differ from the project name, edit it now", "ide_integration": "Whether to generate IDE configuration files", - "issue_categorization": "How to categorize issues in the issue templates. Choose “issue types” only if your GitHub organization has issue types enabled (https://docs.github.com/en/issues/tracking-your-work-with-issues/configuring-issues/managing-issue-types-in-an-organization); otherwise choose “labels”" + "issue_categorization": "How to categorize issues in the issue templates. “issue types” only works in GitHub organizations, while “labels” also works in personal repos." } } From 71db8d4eecf0715f700602f45a89392c0f610fe4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 8 Jun 2026 15:43:57 +0000 Subject: [PATCH 3/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- cookiecutter.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index d9f83864..9b2cc71b 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -15,10 +15,7 @@ "Unlicense" ], "ide_integration": true, - "issue_categorization": [ - "labels", - "issue types" - ], + "issue_categorization": ["labels", "issue types"], "_copy_without_render": [ ".github/workflows/build.yaml", ".github/workflows/test.yaml",