Skip to content

Commit 0dabdcf

Browse files
Include co-authors in release announcement (#12795) (#12797)
As noted in #12789, the `release.py` script did not consider `Co-authored-by` fields, and since we introduced the new backport bot, this problem became more apparent due to how the backport commit and PR are generated. Previously, the list of authors produced by the script in the #12789 branch was: ``` * Avasam * Bruno Oliveira * Ronny Pfannschmidt * Sviatoslav Sydorenko (Святослав Сидоренко) ``` With this script: ``` * Anthony Sottile * Avasam * Bruno Oliveira * Christian Clauss * Eugene Mwangi * Florian Bruhin * GTowers1 * Nauman Ahmed * Pierre Sassoulas * Reagan Lee * Ronny Pfannschmidt * Stefaan Lippens * Sviatoslav Sydorenko (Святослав Сидоренко) * dongfangtianyu ``` (cherry picked from commit e8504ed) Co-authored-by: Bruno Oliveira <[email protected]>
1 parent a9910a4 commit 0dabdcf

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

scripts/release.py

+15-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import argparse
77
import os
88
from pathlib import Path
9+
import re
910
from subprocess import call
1011
from subprocess import check_call
1112
from subprocess import check_output
@@ -16,17 +17,27 @@
1617

1718
def announce(version: str, template_name: str, doc_version: str) -> None:
1819
"""Generates a new release announcement entry in the docs."""
19-
# Get our list of authors
20+
# Get our list of authors and co-authors.
2021
stdout = check_output(["git", "describe", "--abbrev=0", "--tags"], encoding="UTF-8")
2122
last_version = stdout.strip()
23+
rev_range = f"{last_version}..HEAD"
2224

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",
2532
)
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())
2637

2738
contributors = {
2839
name
29-
for name in stdout.splitlines()
40+
for name in authors + co_authors
3041
if not name.endswith("[bot]") and name != "pytest bot"
3142
}
3243

0 commit comments

Comments
 (0)