From 41dc97e1d66f32d95fdf016641164d9f7dc6fb94 Mon Sep 17 00:00:00 2001 From: Alexander Polcyn Date: Thu, 3 Oct 2024 11:30:33 -0700 Subject: [PATCH] Handle backport PRs without piper info in release notes automation Example commits on v1.67.x that are failing the current regex match: ``` commit 1eb5673cdd2471cfa8f68dbe1123c35e9ee03574 Author: apolcyn Date: Mon Sep 16 12:35:34 2024 -0700 [objc] backport https://github.com/grpc/grpc/pull/37690 to v1.67.x (#37712) Backport https://github.com/grpc/grpc/pull/37690 cc @HannahShiSFB @sampajano Co-authored-by: Hannah Shi commit ace22e307d1bb2f81420cd55a81b2725f50c894b Author: apolcyn Date: Thu Sep 12 10:16:46 2024 -0700 [ruby] reduce an INFO log to DEBUG (backport https://github.com/grpc/grpc/pull/37633) (#37686) Backport https://github.com/grpc/grpc/pull/37633 to 1.67 Note https://github.com/grpc/grpc/pull/37633 is not yet merged b/c of the master branch freeze. Merging on 1.67 with the idea that https://github.com/grpc/grpc/pull/37633 will merge as soon as the master branch is unfrozen. ``` PiperOrigin-RevId: 681960402 --- tools/release/release_notes.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/release/release_notes.py b/tools/release/release_notes.py index 5576b9f7161..a8423bf69b3 100644 --- a/tools/release/release_notes.py +++ b/tools/release/release_notes.py @@ -104,15 +104,16 @@ def get_commit_detail(commit): detail += "- " + title if not title.endswith("."): detail += "." - matches = re.search("PiperOrigin-RevId: ([0-9]+)$", output) - cl_num = matches.group(1) - detail += ( - " ([commit](https://github.com/grpc/grpc/commit/" - + commit - + ")) ([CL](https://critique.corp.google.com/cl/" - + cl_num - + "))" + detail += " ([commit](https://github.com/grpc/grpc/commit/{}))".format( + commit ) + matches = re.search("PiperOrigin-RevId: ([0-9]+)$", output) + # backport commits might not have PiperOrigin-RevId + if matches is not None: + cl_num = matches.group(1) + detail += " ([CL](https://critique.corp.google.com/cl/{}))".format( + cl_num + ) return detail