From 6639cfa1e6bb91a021779a885462bf5484673776 Mon Sep 17 00:00:00 2001 From: Xuan Yang Date: Thu, 18 Jun 2026 13:12:06 -0700 Subject: [PATCH] ci: Refine Copybara PR detection in GitHub workflow Co-authored-by: Xuan Yang PiperOrigin-RevId: 934514697 --- .github/workflows/copybara-pr-handler.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/copybara-pr-handler.yml b/.github/workflows/copybara-pr-handler.yml index 7c86daea..195195c2 100644 --- a/.github/workflows/copybara-pr-handler.yml +++ b/.github/workflows/copybara-pr-handler.yml @@ -59,11 +59,12 @@ jobs: console.log(`Committer: ${committer}`); // Check if this is a Copybara commit or has a pull request reference + const prRegex = /Merges?:?\s+(?:https:\/\/github\.com\/google\/adk-python\/pull\/|#)(\d+)/i; const isCopybara = committer === 'Copybara-Service' || commit.author?.email === 'genai-sdk-bot@google.com' || message.includes('GitOrigin-RevId:') || message.includes('PiperOrigin-RevId:') || - /Merge:?\s+https:\/\/github\.com\/google\/adk-python\/pull\/(\d+)/.test(message); + prRegex.test(message); if (!isCopybara) { console.log('Not a Copybara commit, skipping'); @@ -71,8 +72,7 @@ jobs: } // Extract PR number from commit message - // Pattern matches both "Merge https://..." and "Merge: https://..." - const prMatch = message.match(/Merge:?\s+https:\/\/github\.com\/google\/adk-python\/pull\/(\d+)/); + const prMatch = message.match(prRegex); if (!prMatch) { console.log('No PR number found in Copybara commit message');