forked from openslide/openslide-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmkmaintainer.py
More file actions
executable file
·27 lines (23 loc) · 866 Bytes
/
mkmaintainer.py
File metadata and controls
executable file
·27 lines (23 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env python
from __future__ import annotations
from pathlib import Path
from urllib.parse import urlencode
import yaml
dir = Path(__file__).parent
with open(dir / 'README.md', 'w') as fh:
fh.write('<!-- Generated by mkmaintainer.py; do not edit -->\n\n')
fh.write('## Maintainer issue templates\n\n')
for path in sorted(dir.iterdir()):
if path.name == 'README.md' or path.suffix != '.md':
continue
_, front, body = path.read_text().split('---\n', 2)
info = yaml.safe_load(front)
args = urlencode(
{
'title': info['title'],
'body': body.strip(),
'labels': ','.join(info.get('labels', [])),
}
)
url = f"https://github.com/{info['repo']}/issues/new?{args}"
fh.write(f"- [{info['link-text']}]({url})\n")