Skip to content

Commit f21538d

Browse files
committed
Detect linked issues at the end of PR bodies in provider testing issue
The provider testing issue generator missed linked issues when the reference was the last thing in the PR body (a common shape: "Fixes character after the number, which does not exist at end of string, so the reference was silently dropped and the release manager had to add the issue to the testing issue by hand (e.g. apache#53843 for the google 22.3.0rc1 issue). A negative lookahead matches the same references without needing a trailing character.
1 parent c42540f commit f21538d

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

‎dev/breeze/src/airflow_breeze/commands/release_management_commands.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@
256256
SOURCE_DIR_PATH = str(AIRFLOW_ROOT_PATH)
257257
PR_PATTERN = re.compile(r".*\(#([0-9]+)\)")
258258
PR_REFERENCE_PATTERN = re.compile(r"#([0-9]+)")
259-
ISSUE_MATCH_IN_BODY = re.compile(r" #([0-9]+)[^0-9]")
259+
ISSUE_MATCH_IN_BODY = re.compile(r" #([0-9]+)(?![0-9])")
260260
# Release-management commits (provider documentation / release preparation) are pure
261261
# release-process noise: they are not user-facing changes and existing providers already
262262
# exclude them (the release tooling parks them in the changelog's excluded section). Match

‎dev/breeze/tests/test_release_management_commands.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
from airflow_breeze.commands import release_management_commands
2525
from airflow_breeze.commands.release_management_commands import (
26+
ISSUE_MATCH_IN_BODY,
2627
_ensure_default_python_for_reproducible_client,
2728
_is_initial_provider_release,
2829
_should_include_provider_in_issue,
@@ -292,3 +293,18 @@ def test_get_package_version_possibly_from_stable_txt_for_java_sdk(
292293
stable_txt.parent.mkdir(parents=True)
293294
stable_txt.write_text(stable_txt_content)
294295
assert get_package_version_possibly_from_stable_txt("java-sdk") == expected_version
296+
297+
298+
@pytest.mark.parametrize(
299+
("body", "expected"),
300+
[
301+
("Some description closes: #12345 and more text", [12345]),
302+
# reference at the very end of the body (e.g. "Fixes #53843" as the last line)
303+
("Generated-by: some agent Fixes #53843", [53843]),
304+
("related: #111, also see #222", [111, 222]),
305+
("no references here", []),
306+
("PR#123 without space is not a reference", []),
307+
],
308+
)
309+
def test_issue_match_in_body(body: str, expected: list[int]):
310+
assert [int(m.group(1)) for m in ISSUE_MATCH_IN_BODY.finditer(body)] == expected

0 commit comments

Comments
 (0)