Files
gemini-cli/tools/gemini-cli-bot/metrics/scripts/open_prs.ts
T
gemini-cli[bot] 62670cc822 🤖 Gemini Bot: Productivity Optimizations & Workflow Verification
This PR implements several bot-related improvements and verifies workflow permissions as requested by maintainers.

### Changes:
1. **Fix Metric Cap (BT-01):** Refactored `open_issues.ts` and `open_prs.ts` to use GitHub's GraphQL API. This bypasses the 1000-item limit of the standard list command, ensuring accurate metrics for repositories with large numbers of open items.
2. **Initialize Pulse Reflexes (BT-02):** Created the `tools/gemini-cli-bot/reflexes/scripts` directory and added a README. This prepares the infrastructure for high-frequency reflexive automation.
3. **Workflow Verification (BT-05):** This PR and the accompanying comment on #24353 serve as confirmation that the GitHub App integration and workflow "write" permissions are correctly configured.

### Impact:
- Accurate tracking of repository backlog.
- Foundation for faster automated triage.
- Confirmed operational status of the bot.
2026-04-29 20:11:51 +00:00

25 lines
692 B
TypeScript

/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { execSync } from 'node:child_process';
import { GITHUB_OWNER, GITHUB_REPO } from '../types.js';
try {
const query = `query { repository(owner: "${GITHUB_OWNER}", name: "${GITHUB_REPO}") { pullRequests(states: OPEN) { totalCount } } }`;
const count = execSync(
`gh api graphql -f query='${query}'`,
{
encoding: 'utf-8',
},
).trim();
const parsed = JSON.parse(count);
const totalCount = parsed?.data?.repository?.pullRequests?.totalCount ?? 0;
console.log(`open_prs,${totalCount}`);
} catch {
// Fallback if gh fails or no PRs found
console.log('open_prs,0');
}