diff --git a/cookiecutter.json b/cookiecutter.json index e6d37188..9b2cc71b 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -15,6 +15,7 @@ "Unlicense" ], "ide_integration": true, + "issue_categorization": ["labels", "issue types"], "_copy_without_render": [ ".github/workflows/build.yaml", ".github/workflows/test.yaml", @@ -45,6 +46,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. “issue types” only works in GitHub organizations, while “labels” also works in personal repos." } } 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