|
6 | 6 | import argparse
|
7 | 7 | import os
|
8 | 8 | from pathlib import Path
|
| 9 | +import re |
9 | 10 | from subprocess import call
|
10 | 11 | from subprocess import check_call
|
11 | 12 | from subprocess import check_output
|
|
16 | 17 |
|
17 | 18 | def announce(version: str, template_name: str, doc_version: str) -> None:
|
18 | 19 | """Generates a new release announcement entry in the docs."""
|
19 |
| - # Get our list of authors |
| 20 | + # Get our list of authors and co-authors. |
20 | 21 | stdout = check_output(["git", "describe", "--abbrev=0", "--tags"], encoding="UTF-8")
|
21 | 22 | last_version = stdout.strip()
|
| 23 | + rev_range = f"{last_version}..HEAD" |
22 | 24 |
|
23 |
| - stdout = check_output( |
24 |
| - ["git", "log", f"{last_version}..HEAD", "--format=%aN"], encoding="UTF-8" |
| 25 | + authors = check_output( |
| 26 | + ["git", "log", rev_range, "--format=%aN"], encoding="UTF-8" |
| 27 | + ).splitlines() |
| 28 | + |
| 29 | + co_authors_output = check_output( |
| 30 | + ["git", "log", rev_range, "--format=%(trailers:key=Co-authored-by) "], |
| 31 | + encoding="UTF-8", |
25 | 32 | )
|
| 33 | + co_authors: list[str] = [] |
| 34 | + for co_author_line in co_authors_output.splitlines(): |
| 35 | + if m := re.search(r"Co-authored-by: (.+?)<", co_author_line): |
| 36 | + co_authors.append(m.group(1).strip()) |
26 | 37 |
|
27 | 38 | contributors = {
|
28 | 39 | name
|
29 |
| - for name in stdout.splitlines() |
| 40 | + for name in authors + co_authors |
30 | 41 | if not name.endswith("[bot]") and name != "pytest bot"
|
31 | 42 | }
|
32 | 43 |
|
|
0 commit comments