mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-11 22:51:00 -07:00
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright 2026 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
import { execSync } from 'node:child_process';
|
|
|
|
const EVALS_FILE_PREFIXES = [
|
|
'packages/core/src/prompts/',
|
|
'packages/core/src/tools/',
|
|
];
|
|
|
|
function main() {
|
|
try {
|
|
// Fetch main branch to compare against. Use || true to avoid failing if already up to date or no remote.
|
|
execSync('git fetch https://github.com/google-gemini/gemini-cli.git main', {
|
|
stdio: 'ignore',
|
|
});
|
|
|
|
// Find the merge base with main
|
|
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`, {
|
|
encoding: 'utf-8',
|
|
})
|
|
.split('\n')
|
|
.filter(Boolean);
|
|
|
|
const shouldRun = changedFiles.some((file) =>
|
|
EVALS_FILE_PREFIXES.some((prefix) => file.startsWith(prefix)),
|
|
);
|
|
|
|
console.log(shouldRun ? 'true' : 'false');
|
|
} catch {
|
|
// If anything fails (e.g., no git history), run evals to be safe
|
|
console.log('true');
|
|
}
|
|
}
|
|
|
|
main();
|