mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-04 10:07:28 +01:00
release notes: read the author from the PR line's own by-clause
A title that itself contains "by @someone in" gave the wrong author, and a dependabot mention there sent the PR to Dependencies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
15e7aecdaa
commit
f1eac773cc
2 files changed
+6
-3
No files matched your search
@@ -125,7 +125,7 @@ PATH_RULES = {
|
||||
".github/": "Tests and CI",
|
||||
}
|
||||
|
||||
PR_LINE = re.compile(r"^\* (?P<title>.+?) by @\S+ in https://github\.com/\S+/pull/(?P<num>\d+)\s*$")
|
||||
PR_LINE = re.compile(r"^\* (?P<title>.+?) by @(?P<author>\S+) in https://github\.com/\S+/pull/(?P<num>\d+)\s*$")
|
||||
# Lines regroup() writes between the PRs, so a second run accepts them.
|
||||
SCAFFOLD = re.compile(r"^$|^### |^<details>|^</details>$")
|
||||
# "fix(s3tables,s3vectors): ...", "s3 lifecycle: ...", "[Volume] ...", "Fix/admin ..."
|
||||
@@ -228,9 +228,8 @@ def regroup(body, pr_files):
|
||||
groups = {s: [] for s in SECTIONS}
|
||||
for line in prs:
|
||||
m = PR_LINE.match(line)
|
||||
author = re.search(r" by @(\S+) in ", line).group(1)
|
||||
num = int(m.group("num"))
|
||||
groups[classify(m.group("title"), author, lambda: pr_files(num))].append(line)
|
||||
groups[classify(m.group("title"), m.group("author"), lambda: pr_files(num))].append(line)
|
||||
|
||||
out = [before, ""] if before else []
|
||||
out.append("## What's Changed")
|
||||
|
||||
@@ -161,6 +161,10 @@ class RegroupTest(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
rn.regroup(body, self.files)
|
||||
|
||||
def test_author_from_the_by_clause(self):
|
||||
body = "## What's Changed\n* Bump a by @dependabot[bot] in docs by @alice in https://github.com/seaweedfs/seaweedfs/pull/7\n"
|
||||
self.assertIn("### Documentation", rn.regroup(body, lambda n: ["README.md"]))
|
||||
|
||||
def test_notes_without_prs_unchanged(self):
|
||||
body = "Hand-written notes\n\n**Full Changelog**: x"
|
||||
self.assertEqual(rn.regroup(body, no_files), body)
|
||||
|
||||
Reference in new issue
Block a user