Skip to content

Commit 0abcd75

Browse files
fix(release): detect upstream refs in note prose
Scan release-note commit bodies for GitHub issue and PR references, not only strict trailer lines, so highlights include upstream provenance from commits such as 'Refs apple/container#1511'.
1 parent 2ecbb24 commit 0abcd75

2 files changed

Lines changed: 39 additions & 3 deletions

File tree

Tools/release/release-notes.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,8 @@ def upstream_references_from_body(body: str) -> list[str]:
344344
seen: set[str] = set()
345345
for line in body.splitlines():
346346
trailer = REFERENCE_TRAILER_PATTERN.match(line.strip())
347-
if trailer is None:
348-
continue
349-
for match in GITHUB_REFERENCE_PATTERN.finditer(trailer.group("value")):
347+
value = trailer.group("value") if trailer is not None else line
348+
for match in GITHUB_REFERENCE_PATTERN.finditer(value):
350349
reference = match.group("reference")
351350
key = reference.lower()
352351
if key in seen:

Tools/release/test_release_notes.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,43 @@ def test_spaced_release_highlights_all_render(self) -> None:
227227
notes,
228228
)
229229

230+
def test_plain_body_upstream_refs_are_attached_to_highlights(self) -> None:
231+
module = load_module()
232+
with tempfile.TemporaryDirectory() as directory:
233+
repo = Path(directory)
234+
self.init_repo(repo)
235+
self.git(repo, "tag", "--no-sign", "0.6.0")
236+
self.commit(
237+
repo,
238+
"feat(gpu): support Compose GPU requests",
239+
body="""
240+
Support Docker Compose service gpus and generic Deploy GPU reservations.
241+
242+
Release-Highlight: Supports Compose `gpus` and deploy GPU reservations through the matched virtio GPU runtime.
243+
244+
Refs apple/container#1511, apple/containerization#480, apple/containerization#569.
245+
""",
246+
)
247+
self.git(repo, "tag", "--no-sign", "0.6.1")
248+
249+
notes = module.render_release_notes(
250+
repo=repo,
251+
release_tag="0.6.1",
252+
release_label="stable release",
253+
compose_version="0.6.1",
254+
asset="container-compose-plugin-release-arm64.tar.gz",
255+
asset_sha="abc123",
256+
head_ref="HEAD",
257+
)
258+
259+
self.assertIn(
260+
"- Supports Compose `gpus` and deploy GPU reservations through "
261+
"the matched virtio GPU runtime. Upstream references: "
262+
"apple/container#1511, apple/containerization#480, "
263+
"apple/containerization#569.",
264+
notes,
265+
)
266+
230267
def test_semver_tag_lists_validated_main_changes(self) -> None:
231268
module = load_module()
232269
with tempfile.TemporaryDirectory() as directory:

0 commit comments

Comments
 (0)