Skip to content

Commit 16d1fb9

Browse files
authored
Add issue templates, keyword labeler and PR labeler to cookiecutter (frequenz-floss#51)
Fixes frequenz-floss#3, fixes frequenz-floss#4, fixes frequenz-floss#5.
2 parents 1501906 + a3a0f0f commit 16d1fb9

File tree

7 files changed

+229
-0
lines changed

7 files changed

+229
-0
lines changed

cookiecutter/hooks/post_gen_project.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,11 @@ def print_todos() -> None:
309309
warn_on_bad_status=f"No `{todo_str}` found using `{' '.join(cmd)}`",
310310
note_on_failure=f"Please search for `{todo_str}` in `{repo}/` manually.",
311311
)
312+
print()
313+
note(
314+
"Make sure to (create and) configure your GitHub repository too: "
315+
"https://github.com/frequenz-floss/frequenz-repo-config-python/wiki/Configuring-a-new-GitHub-repository"
316+
)
312317

313318

314319
def do_sanity_checks() -> list[str]:
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# GitHub issue form. For more information see:
2+
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms
3+
4+
name: Report something is not working properly 🐛
5+
description:
6+
Use this if there is something that is not working properly. If you are not
7+
sure or you need help making something work, please ask a question instead.
8+
labels:
9+
- "priority:❓"
10+
- "type:bug"
11+
body:
12+
- type: markdown
13+
attributes:
14+
value:
15+
Thanks for taking the time to fill out this bug report!
16+
- type: textarea
17+
id: what-happened
18+
attributes:
19+
label: What happened?
20+
description: Please tell us what happened that shouldn't have.
21+
placeholder: What happened that shouldn't have.
22+
validations:
23+
required: true
24+
- type: textarea
25+
id: what-expected
26+
attributes:
27+
label: What did you expect instead?
28+
description: Please tell us what did you expect to happen.
29+
placeholder: What did you expect to happen.
30+
validations:
31+
required: true
32+
- type: input
33+
id: version
34+
attributes:
35+
label: Affected version(s)
36+
description:
37+
Please add a comma-separated list of the versions affected by this
38+
issue.
39+
placeholder: 'Example: v0.11.0, v0.12.0'
40+
- type: dropdown
41+
id: part
42+
attributes:
43+
label: Affected part(s)
44+
description:
45+
Which parts of the repo are affected by this issue? Select all that
46+
apply.
47+
multiple: true
48+
options:
49+
- I don't know (part:❓)
50+
- Documentation (part:docs)
51+
- Unit, integration and performance tests (part:tests)
52+
- Build script, CI, dependencies, etc. (part:tooling)
53+
# TODO(cookiecutter): Add other parts
54+
# Please have in mind that that the part:xxx should be created as
55+
# a issue label in the GitHub repository"
56+
validations:
57+
required: true
58+
- type: textarea
59+
id: extra
60+
attributes:
61+
label: Extra information
62+
description:
63+
Please write here any extra information you think it might be relevant,
64+
e.g., if this didn't happen before, or if you suspect where the problem
65+
might be.
66+
placeholder: Any extra information you think it might be relevant.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# GitHub issue template chooser. For more information see:
2+
# 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
3+
4+
blank_issues_enabled: true
5+
contact_links:
6+
- name: Ask a question ❓
7+
url: https://github.com/{{github_org}}/{{github_repo_name}}/discussions/new?category=support
8+
# TODO(cookiecutter): Make sure the GitHub repository has a discussion category "Support"
9+
# Rename the "Q&A" category to "Support" and change the emoji to 🆘 (SOS)
10+
about: Use this if you are not sure how to do something, have installation problems, etc.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# GitHub issue form. For more information see:
2+
# https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms
3+
4+
name: Request a feature or enhancement ✨
5+
description: Use this if something is missing or could be done better or more easily.
6+
labels:
7+
- "part:❓"
8+
- "priority:❓"
9+
- "type:enhancement"
10+
body:
11+
- type: markdown
12+
attributes:
13+
value:
14+
Thanks for taking the time to fill out this feature or enhancement
15+
request!
16+
- type: textarea
17+
id: whats-needed
18+
attributes:
19+
label: What's needed?
20+
description:
21+
Please tell us what's missing or what could be done better or more easily.
22+
placeholder: What's missing or what could be done better or more easily.
23+
validations:
24+
required: true
25+
- type: textarea
26+
id: solution
27+
attributes:
28+
label: Proposed solution
29+
description:
30+
Please tell us how you think the needs above can be fulfilled. Only
31+
fill this field if it wasn't described above.
32+
placeholder:
33+
How do you think the needs above can be fulfilled. Only fill this field
34+
if it wasn't described above.
35+
- type: textarea
36+
id: use-cases
37+
attributes:
38+
label: Use cases
39+
description:
40+
Please tell us about the main use cases you see for this new feature or
41+
enhancement to help us understand more.
42+
placeholder:
43+
The main use cases you see for this new feature or enhancement to help
44+
us understand more.
45+
- type: textarea
46+
id: alternatives
47+
attributes:
48+
label: Alternatives and workarounds
49+
description:
50+
Please tell us if you tried any alternatives or workarounds for these
51+
use cases and how (un)useful they were.
52+
placeholder:
53+
Any alternatives or workarounds for these use cases and how (un)useful
54+
they were.
55+
- type: textarea
56+
id: additional-context
57+
attributes:
58+
label: Additional context
59+
description:
60+
Please add any additional information here - screenshots, diagrams, etc.
61+
placeholder: Any additional information here - screenshots, diagrams, etc.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# KeywordLabeler app configuration. For more information check:
2+
# https://github.com/ZeWaka/KeywordLabeler#readme
3+
4+
# Determines if we search the title (optional). Defaults to true.
5+
matchTitle: true
6+
7+
# Determines if we search the body (optional). Defaults to true.
8+
matchBody: true
9+
10+
# Determines if label matching is case sensitive (optional). Defaults to true.
11+
caseSensitive: true
12+
13+
# Explicit keyword mappings to labels. Form of match:label. Required.
14+
labelMappings:
15+
"part:docs": "part:docs"
16+
"part:tests": "part:tests"
17+
"part:tooling": "part:tooling"
18+
"part:❓": "part:❓"
19+
# TODO(cookiecutter): Add other parts
20+
# Please have in mind that that the part:xxx should be created as a issue
21+
# label in the GitHub repository"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Configuration for the Labeler GitHub action, executed by
2+
# .github/workflows/labeler.yml.
3+
#
4+
# The basic syntax is [label]: [path patterns].
5+
#
6+
# For more details on the configuration please see:
7+
# https://github.com/marketplace/actions/labeler
8+
9+
# TODO(cookiecutter): Add different parts of the source
10+
# For example:
11+
#
12+
# "part:module":
13+
# - "src/frequenz/{{cookiecutter.type}}/{{cookiecutter.name}}/module/**"
14+
#
15+
# "part:other":
16+
# - "src/frequenz/{{cookiecutter.type}}/{{cookiecutter.name}}/other/**"
17+
#
18+
# Please have in mind that that the part:xxx should be created as a issue label
19+
# in the GitHub repository"
20+
21+
"part:docs":
22+
- "**/*.md"
23+
- "docs/**"
24+
- "examples/**"
25+
- LICENSE
26+
27+
"part:tests":
28+
{%- if cookiecutter.type == "api" %}
29+
- "pytests/**"
30+
{%- else %}
31+
- "tests/**"
32+
{%- endif %}
33+
34+
"part:tooling":
35+
- "**/*.ini"
36+
- "**/*.toml"
37+
- "**/*.yaml"
38+
- "**/*.yml"
39+
- ".git*"
40+
- ".git*/**"
41+
- CODEOWNERS
42+
- MANIFEST.in
43+
- noxfile.py
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Pull Request Labeler
2+
3+
on: [pull_request_target]
4+
5+
jobs:
6+
Label:
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Labeler
13+
# XXX: !!! SECURITY WARNING !!!
14+
# pull_request_target has write access to the repo, and can read secrets. We
15+
# need to audit any external actions executed in this workflow and make sure no
16+
# checked out code is run (not even installing dependencies, as installing
17+
# dependencies usually can execute pre/post-install scripts). We should also
18+
# only use hashes to pick the action to execute (instead of tags or branches).
19+
# For more details read:
20+
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
21+
uses: actions/labeler@0776a679364a9a16110aac8d0f40f5e11009e327 # 4.0.4
22+
with:
23+
repo-token: "${{ secrets.GITHUB_TOKEN }}"

0 commit comments

Comments
 (0)