Skip to content

Commit 6639cfa

Browse files
xuanyang15copybara-github
authored andcommitted
ci: Refine Copybara PR detection in GitHub workflow
Co-authored-by: Xuan Yang <xygoogle@google.com> PiperOrigin-RevId: 934514697
1 parent 139c700 commit 6639cfa

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

.github/workflows/copybara-pr-handler.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,20 @@ jobs:
5959
console.log(`Committer: ${committer}`);
6060
6161
// Check if this is a Copybara commit or has a pull request reference
62+
const prRegex = /Merges?:?\s+(?:https:\/\/github\.com\/google\/adk-python\/pull\/|#)(\d+)/i;
6263
const isCopybara = committer === 'Copybara-Service' ||
6364
commit.author?.email === 'genai-sdk-bot@google.com' ||
6465
message.includes('GitOrigin-RevId:') ||
6566
message.includes('PiperOrigin-RevId:') ||
66-
/Merge:?\s+https:\/\/github\.com\/google\/adk-python\/pull\/(\d+)/.test(message);
67+
prRegex.test(message);
6768
6869
if (!isCopybara) {
6970
console.log('Not a Copybara commit, skipping');
7071
continue;
7172
}
7273
7374
// Extract PR number from commit message
74-
// Pattern matches both "Merge https://..." and "Merge: https://..."
75-
const prMatch = message.match(/Merge:?\s+https:\/\/github\.com\/google\/adk-python\/pull\/(\d+)/);
75+
const prMatch = message.match(prRegex);
7676
7777
if (!prMatch) {
7878
console.log('No PR number found in Copybara commit message');

0 commit comments

Comments
 (0)