From 97bc3f28c56581f7db353186743fad8097c80d6c Mon Sep 17 00:00:00 2001 From: Christian Gunderman Date: Fri, 13 Mar 2026 00:38:54 +0000 Subject: [PATCH] build(ci): fix false positive evals trigger on merge commits (#22237) --- scripts/changed_prompt.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/scripts/changed_prompt.js b/scripts/changed_prompt.js index 9cf7c1a261..0ad0e365f7 100644 --- a/scripts/changed_prompt.js +++ b/scripts/changed_prompt.js @@ -14,18 +14,17 @@ const EVALS_FILE_PREFIXES = [ function main() { const targetBranch = process.env.GITHUB_BASE_REF || 'main'; try { - // Fetch target branch from origin. - execSync(`git fetch origin ${targetBranch}`, { + const remoteUrl = process.env.GITHUB_REPOSITORY + ? `https://github.com/${process.env.GITHUB_REPOSITORY}.git` + : 'origin'; + + // Fetch target branch from the remote. + execSync(`git fetch ${remoteUrl} ${targetBranch}`, { stdio: 'ignore', }); - // Find the merge base with the target branch. - const mergeBase = execSync('git merge-base HEAD FETCH_HEAD', { - encoding: 'utf-8', - }).trim(); - - // Get changed files - const changedFiles = execSync(`git diff --name-only ${mergeBase} HEAD`, { + // Get changed files using the triple-dot syntax which correctly handles merge commits + const changedFiles = execSync(`git diff --name-only FETCH_HEAD...HEAD`, { encoding: 'utf-8', }) .split('\n')