pr-monitor/server/scripts/sync-once.ts
2026-07-28 14:21:25 +00:00

38 lines
1.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { loadConfig } from '../config.js';
import { Db } from '../db.js';
import { runPoll } from '../poller.js';
import { getLastRateLimit } from '../github/client.js';
const config = loadConfig();
const db = new Db();
console.log(`search: ${config.searchQuery}\n`);
const result = await runPoll(config, db);
const stateIcon: Record<string, string> = {
fail: '✗',
running: '◐',
pending: '·',
pass: '✓',
skipped: '',
none: ' ',
};
for (const pr of db.getOpenSnapshots()) {
const cats = pr.categories
.map((c) => `${c.category}:${stateIcon[c.state]}${c.total ? ` ${c.passed}/${c.total}` : ''}`)
.join(' ');
console.log(
`${pr.repo}#${pr.number} [${pr.reviewState}${pr.unresolvedThreads ? ` ${pr.unresolvedThreads} open` : ''}] ${cats} ${pr.title.slice(0, 60)}`,
);
const other = pr.categories.find((c) => c.category === 'other');
if (other && other.checks.length > 0) {
console.log(` other checks: ${other.checks.map((c) => c.name).join(', ')}`);
}
}
console.log(
`\n${result.prCount} PRs, ${result.changedPrIds.length} changed, ${result.newEventCount} new events`,
);
console.log(`rate limit: ${JSON.stringify(getLastRateLimit())}`);