mirror of
https://github.com/stablyai/orca.git
synced 2026-09-30 08:03:12 +00:00
fix: bypass gh CLI HTTP cache on manual PR checks refresh (#308)
The `gh api --cache 60s` flag caused stale check-run data even when the user explicitly clicked refresh. Thread a `noCache` flag through IPC so manual refreshes skip the gh CLI cache while polling still benefits from it.
This commit is contained in:
@@ -120,18 +120,21 @@ export async function getPRForBranch(repoPath: string, branch: string): Promise<
|
||||
export async function getPRChecks(
|
||||
repoPath: string,
|
||||
prNumber: number,
|
||||
branch?: string
|
||||
branch?: string,
|
||||
options?: { noCache?: boolean }
|
||||
): Promise<PRCheckDetail[]> {
|
||||
const ownerRepo = branch ? await getOwnerRepo(repoPath) : null
|
||||
await acquire()
|
||||
try {
|
||||
if (ownerRepo && branch) {
|
||||
// Why: --cache 60s saves rate-limit budget during polling, but when the
|
||||
// user explicitly clicks refresh we must skip it so gh fetches fresh data.
|
||||
const cacheArgs = options?.noCache ? [] : ['--cache', '60s']
|
||||
const { stdout } = await execFileAsync(
|
||||
'gh',
|
||||
[
|
||||
'api',
|
||||
'--cache',
|
||||
'60s',
|
||||
...cacheArgs,
|
||||
`repos/${ownerRepo.owner}/${ownerRepo.repo}/commits/${encodeURIComponent(branch)}/check-runs?per_page=100`
|
||||
],
|
||||
{ cwd: repoPath, encoding: 'utf-8' }
|
||||
|
||||
Reference in New Issue
Block a user