2026-04-24 17:16:20 +00:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2026 Google LLC
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2026-04-28 16:07:32 +00:00
|
|
|
import { GITHUB_OWNER, GITHUB_REPO } from '../types.js';
|
2026-04-24 17:16:20 +00:00
|
|
|
import { execSync } from 'node:child_process';
|
|
|
|
|
|
|
|
|
|
try {
|
2026-04-28 16:07:32 +00:00
|
|
|
const query = `
|
|
|
|
|
query($owner: String!, $repo: String!) {
|
|
|
|
|
repository(owner: $owner, name: $repo) {
|
|
|
|
|
issues(states: OPEN) {
|
|
|
|
|
totalCount
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
const output = execSync(
|
|
|
|
|
`gh api graphql -F owner=${GITHUB_OWNER} -F repo=${GITHUB_REPO} -f query='${query}'`,
|
|
|
|
|
{ encoding: 'utf-8' },
|
|
|
|
|
);
|
|
|
|
|
const data = JSON.parse(output).data.repository;
|
|
|
|
|
console.log(`open_issues,${data.issues.totalCount}`);
|
2026-04-24 17:16:20 +00:00
|
|
|
} catch {
|
|
|
|
|
// Fallback if gh fails or no issues found
|
|
|
|
|
console.log('open_issues,0');
|
|
|
|
|
}
|