Files
gemini-cli/tools/gemini-cli-bot/metrics/scripts/open_issues.ts
T
Christian Gunderman 8dbfe52e37 Fix linter.
2026-04-29 10:29:47 -07:00

38 lines
972 B
TypeScript

/**
* @license
* Copyright 2026 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import { GITHUB_OWNER, GITHUB_REPO } from '../types.js';
import { execSync } from 'node:child_process';
try {
const query = `
query($owner: String!, $repo: String!) {
repository(owner: $owner, name: $repo) {
issues(states: OPEN) {
totalCount
}
}
}
`;
const output = execSync(
'gh api graphql -F owner=$OWNER -F repo=$REPO -f query=@-',
{
encoding: 'utf-8',
input: query,
env: { ...process.env, OWNER: GITHUB_OWNER, REPO: GITHUB_REPO },
},
);
const response = JSON.parse(output);
if (response.errors) {
throw new Error(response.errors.map((e: { message: string }) => e.message).join(', '));
}
const count = response.data.repository.issues.totalCount;
console.log(`open_issues,${count}`);
} catch (err) {
process.stderr.write(err instanceof Error ? err.message : String(err));
process.exit(1);
}