mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-12 12:54:07 -07:00
feat: add 'fix-pr' skill for agentic iterative PR fixing
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* CI Waiter Utility for Fix PR Skill
|
||||
* Blocks until GitHub checks for the current branch are complete.
|
||||
*/
|
||||
import { spawnSync } from 'child_process';
|
||||
|
||||
async function wait(ms: number) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
async function main() {
|
||||
console.log('🔍 Waiting for GitHub Checks to complete...');
|
||||
|
||||
let attempts = 0;
|
||||
const maxAttempts = 30; // 15 minutes total
|
||||
|
||||
while (attempts < maxAttempts) {
|
||||
const checkStatus = spawnSync('gh', ['pr', 'checks'], { shell: true });
|
||||
const output = checkStatus.stdout.toString();
|
||||
|
||||
if (output.includes('fail')) {
|
||||
console.log('❌ CI Failed.');
|
||||
process.exit(1);
|
||||
} else if (output.includes('pending')) {
|
||||
console.log(`⏳ CI still pending... (check ${attempts + 1}/${maxAttempts})`);
|
||||
await wait(30000); // 30 seconds
|
||||
} else if (output.trim() === '') {
|
||||
console.log('⚠️ No checks found yet, waiting...');
|
||||
await wait(10000);
|
||||
} else {
|
||||
console.log('✅ CI Passed!');
|
||||
process.exit(0);
|
||||
}
|
||||
attempts++;
|
||||
}
|
||||
|
||||
console.error('⏰ Timeout waiting for CI.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
main().catch(console.error);
|
||||
Reference in New Issue
Block a user