🤖 Gemini Bot Maintenance Update

This commit is contained in:
gemini-cli[bot]
2026-05-14 18:46:01 +00:00
parent 456d1aec74
commit b0ec765366
5 changed files with 132 additions and 94 deletions
@@ -10,17 +10,23 @@ import { GITHUB_OWNER, GITHUB_REPO } from '../types.js';
import { execSync } from 'node:child_process';
try {
const sevenDaysAgo = new Date();
sevenDaysAgo.setDate(sevenDaysAgo.getDate() - 7);
const dateStr = sevenDaysAgo.toISOString().split('T')[0];
const query = `
query($owner: String!, $repo: String!) {
repository(owner: $owner, name: $repo) {
pullRequests(last: 100, states: MERGED) {
nodes {
query($prQuery: String!, $issueQuery: String!) {
prSearch: search(query: $prQuery, type: ISSUE, first: 1000) {
nodes {
... on PullRequest {
authorAssociation
mergedAt
}
}
issues(last: 100, states: CLOSED) {
nodes {
}
issueSearch: search(query: $issueQuery, type: ISSUE, first: 1000) {
nodes {
... on Issue {
authorAssociation
closedAt
}
@@ -28,25 +34,28 @@ try {
}
}
`;
const prQuery = `repo:${GITHUB_OWNER}/${GITHUB_REPO} is:pr is:merged merged:>=${dateStr}`;
const issueQuery = `repo:${GITHUB_OWNER}/${GITHUB_REPO} is:issue is:closed closed:>=${dateStr}`;
const output = execSync(
`gh api graphql -F owner=${GITHUB_OWNER} -F repo=${GITHUB_REPO} -f query='${query}'`,
`gh api graphql -F prQuery='${prQuery}' -F issueQuery='${issueQuery}' -f query='${query}'`,
{ encoding: 'utf-8' },
);
const data = JSON.parse(output).data.repository;
const data = JSON.parse(output).data;
if (!data) {
throw new Error('No data returned from GraphQL API');
}
const prs = data.pullRequests.nodes
.map((p: { authorAssociation: string; mergedAt: string }) => ({
association: p.authorAssociation,
date: new Date(p.mergedAt).getTime(),
}))
.sort((a: { date: number }, b: { date: number }) => a.date - b.date);
const prs = (data.prSearch?.nodes || []).map((p: any) => ({
association: p.authorAssociation,
date: new Date(p.mergedAt).getTime(),
}));
const issues = data.issues.nodes
.map((i: { authorAssociation: string; closedAt: string }) => ({
association: i.authorAssociation,
date: new Date(i.closedAt).getTime(),
}))
.sort((a: { date: number }, b: { date: number }) => a.date - b.date);
const issues = (data.issueSearch?.nodes || []).map((i: any) => ({
association: i.authorAssociation,
date: new Date(i.closedAt).getTime(),
}));
const isMaintainer = (assoc: string) =>
['MEMBER', 'OWNER', 'COLLABORATOR'].includes(assoc);
@@ -54,11 +63,7 @@ try {
const calculateThroughput = (
items: { association: string; date: number }[],
) => {
if (items.length < 2) return 0;
const first = items[0].date;
const last = items[items.length - 1].date;
const days = (last - first) / (1000 * 60 * 60 * 24);
return days > 0 ? items.length / days : items.length; // items per day
return items.length / 7; // items per day over 7-day window
};
const prOverall = calculateThroughput(prs);