mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-11 14:40:52 -07:00
ci(evals): only run evals if prompts or tools changed
This commit is contained in:
40
scripts/check_evals_trigger.js
Normal file
40
scripts/check_evals_trigger.js
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { execSync } from 'node:child_process';
|
||||
|
||||
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) =>
|
||||
file.startsWith('packages/core/src/prompts/') ||
|
||||
file.startsWith('packages/core/src/tools/'),
|
||||
);
|
||||
|
||||
console.log(shouldRun ? 'true' : 'false');
|
||||
} catch (_error) {
|
||||
// If anything fails (e.g., no git history), run evals to be safe
|
||||
console.log('true');
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
||||
Reference in New Issue
Block a user