ci: Support bot-authored commits in PR handler

Ensure both types of Copybara PR commits are correctly identified and parsed by checking author email, headers, and updated merge regex.

Change-Id: Ic0cc19f67a3db4637fa597702393a11802b3f9aa
This commit is contained in:
Xuan Yang
2026-05-22 12:14:33 -07:00
parent e56c021ef7
commit ecb759cc16
+8 -3
View File
@@ -58,14 +58,19 @@ jobs:
console.log(`Committer: ${committer}`);
// Check if this is a Copybara commit
if (committer !== 'Copybara-Service') {
const isCopybara = committer === 'Copybara-Service' ||
commit.author?.email === 'genai-sdk-bot@google.com' ||
message.includes('GitOrigin-RevId:') ||
message.includes('PiperOrigin-RevId:');
if (!isCopybara) {
console.log('Not a Copybara commit, skipping');
continue;
}
// Extract PR number from commit message
// Pattern: "Merge https://github.com/google/adk-python/pull/3333"
const prMatch = message.match(/Merge https:\/\/github\.com\/google\/adk-python\/pull\/(\d+)/);
// Pattern matches both "Merge https://..." and "Merge: https://..."
const prMatch = message.match(/Merge:?\s+https:\/\/github\.com\/google\/adk-python\/pull\/(\d+)/);
if (!prMatch) {
console.log('No PR number found in Copybara commit message');