Skip to content

Commit b3ab095

Browse files
committed
Autogenerate Markdown file with release checklist links
GitHub removed the feature allowing Markdown issue templates without front matter to be used in the `template` query argument. Adding front matter would cause the template to appear in the user-facing issue template chooser, degrading the issue UX a bit. However, we can still autofill the issue body by including it inline in the `body` query argument. Move maintainer templates to a separate directory and autogenerate a README.md that embeds them. Signed-off-by: Benjamin Gilbert <bgilbert@cs.cmu.edu>
1 parent 46cac54 commit b3ab095

File tree

4 files changed

+46
-0
lines changed

4 files changed

+46
-0
lines changed

.github/maintainer/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<!-- Generated by mkmaintainer.py; do not edit -->
2+
3+
## Maintainer issue templates
4+
5+
- [Release checklist](https://github.com/openslide/openslide-java/issues/new?title=Release+X.Y.Z&body=%23+OpenSlide+Java+release+process%0A%0A-+%5B+%5D+Update+%60CHANGELOG.md%60+and+version+in+%60pom.xml%60%0A-+%5B+%5D+Create+and+push+signed+tag%0A-+%5B+%5D+Verify+that+GitHub+Actions+created+a+%5BGitHub+release%5D%28https%3A%2F%2Fgithub.com%2Fopenslide%2Fopenslide-java%2Freleases%29+with+release+notes+and+a+JAR%0A-+%5B+%5D+Update+website%3A+%60_data%2Freleases.yaml%60%2C+%60_includes%2Fnews.md%60%0A-+%5B+%5D+Send+mail+to+-announce+and+-users%0A-+%5B+%5D+Post+to+%5Bforum.image.sc%5D%28https%3A%2F%2Fforum.image.sc%2Fc%2Fannouncements%2F10%29&labels=release)

.github/maintainer/mkmaintainer.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/python
2+
3+
from pathlib import Path
4+
from urllib.parse import urlencode
5+
6+
import yaml
7+
8+
dir = Path(__file__).parent
9+
with open(dir / 'README.md', 'w') as fh:
10+
fh.write('<!-- Generated by mkmaintainer.py; do not edit -->\n\n')
11+
fh.write('## Maintainer issue templates\n\n')
12+
for path in sorted(dir.iterdir()):
13+
if path.name == 'README.md' or path.suffix != '.md':
14+
continue
15+
_, front, body = path.read_text().split('---\n', 2)
16+
info = yaml.safe_load(front)
17+
args = urlencode(
18+
{
19+
'title': info['title'],
20+
'body': body.strip(),
21+
'labels': ','.join(info.get('labels', [])),
22+
}
23+
)
24+
url = f"https://github.com/{info['repo']}/issues/new?{args}"
25+
fh.write(f"- [{info['link-text']}]({url})\n")
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
---
2+
link-text: Release checklist
3+
repo: openslide/openslide-java
4+
title: Release X.Y.Z
5+
labels: [release]
6+
---
7+
18
# OpenSlide Java release process
29

310
- [ ] Update `CHANGELOG.md` and version in `pom.xml`

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,12 @@ repos:
2626
hooks:
2727
- id: check-hooks-apply
2828
- id: check-useless-excludes
29+
30+
- repo: local
31+
hooks:
32+
- id: mkmaintainer
33+
name: Sync maintainer issue templates
34+
entry: .github/maintainer/mkmaintainer.py
35+
files: .github/maintainer/
36+
language: python
37+
additional_dependencies: [PyYAML]

0 commit comments

Comments
 (0)