mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-09 09:30:41 -07:00
feat(optimizer): improve process scripts to address stuck issues and stale PRs
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
const { execSync } = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
function run() {
|
||||
try {
|
||||
// Fetch 1000 open issues
|
||||
console.log('Fetching open issues...');
|
||||
const output = execSync('gh issue list --state open --json labels --limit 1000', { encoding: 'utf-8' });
|
||||
const issues = JSON.parse(output);
|
||||
|
||||
const labelCounts = {};
|
||||
for (const issue of issues) {
|
||||
if (issue.labels && issue.labels.length > 0) {
|
||||
for (const label of issue.labels) {
|
||||
labelCounts[label.name] = (labelCounts[label.name] || 0) + 1;
|
||||
}
|
||||
} else {
|
||||
labelCounts['NO_LABEL'] = (labelCounts['NO_LABEL'] || 0) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
const sortedLabels = Object.entries(labelCounts).sort((a, b) => b[1] - a[1]);
|
||||
console.log('Label distribution for open issues:');
|
||||
|
||||
let csvContent = 'label,count\n';
|
||||
for (const [label, count] of sortedLabels) {
|
||||
console.log(`${label}: ${count}`);
|
||||
csvContent += `"${label}",${count}\n`;
|
||||
}
|
||||
|
||||
const csvPath = path.join(__dirname, '..', 'issue_labels.csv');
|
||||
fs.writeFileSync(csvPath, csvContent, 'utf8');
|
||||
console.log(`Saved findings to ${csvPath}`);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error fetching issues:', error.message);
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
@@ -0,0 +1,46 @@
|
||||
const { execSync } = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
function run() {
|
||||
try {
|
||||
console.log('Fetching open PRs...');
|
||||
// Fetch up to 1000 open PRs
|
||||
const output = execSync('gh pr list --state open --json labels,createdAt,author --limit 1000', { encoding: 'utf-8' });
|
||||
const prs = JSON.parse(output);
|
||||
|
||||
console.log(`Total open PRs fetched: ${prs.length}`);
|
||||
|
||||
const labelCounts = {};
|
||||
let communityPrCount = 0;
|
||||
|
||||
for (const pr of prs) {
|
||||
// Assuming a simplistic check for community PRs: author is not a known bot/core team, or has specific labels
|
||||
if (pr.labels && pr.labels.length > 0) {
|
||||
for (const label of pr.labels) {
|
||||
labelCounts[label.name] = (labelCounts[label.name] || 0) + 1;
|
||||
}
|
||||
} else {
|
||||
labelCounts['NO_LABEL'] = (labelCounts['NO_LABEL'] || 0) + 1;
|
||||
}
|
||||
}
|
||||
|
||||
const sortedLabels = Object.entries(labelCounts).sort((a, b) => b[1] - a[1]);
|
||||
console.log('\nLabel distribution for open PRs:');
|
||||
|
||||
let csvContent = 'label,count\n';
|
||||
for (const [label, count] of sortedLabels) {
|
||||
console.log(`${label}: ${count}`);
|
||||
csvContent += `"${label}",${count}\n`;
|
||||
}
|
||||
|
||||
const csvPath = path.join(__dirname, '..', 'pr_labels.csv');
|
||||
fs.writeFileSync(csvPath, csvContent, 'utf8');
|
||||
console.log(`Saved findings to ${csvPath}`);
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error fetching PRs:', error.message);
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
Reference in New Issue
Block a user