mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-25 17:41:35 +01:00
A skipped CI run no longer blocks reusing a passing run on the same commit (GST-3514) (#4695)
When one commit gets two runs of the same workflow and the newer one skipped every job, the passing run can now be reused, and the CI wait no longer reports that commit red. gbrain hit this when a pull request run that skipped all its jobs, created in the same second as a passing manual run, blocked that passing run. Nothing to do: a newer failed, cancelled or still-running run still blocks reuse exactly as before. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Review-Finding: p1/specialist-batched#1 reader=red-team
This commit is contained in:
1 parent
25bf93c4e2
commit
7530280407
6 files changed
+27
-3
No files matched your search
+2
-1
@@ -175,7 +175,8 @@ const PASSING = ['success', 'skipped', 'neutral'];
|
||||
export async function waitForRun(deps: RunDeps, o: { workflow: string; events: string[]; head: string; also?: string[]; timeoutMs: number; intervalMs: number; sleep: (ms: number) => Promise<void>; clock: () => number; random?: () => number }): Promise<WaitVerdict> {
|
||||
const end = o.clock() + o.timeoutMs;
|
||||
for (;;) {
|
||||
const newest = [o.head, ...(o.also ?? [])].flatMap(h => deps.runsForHead(o.workflow, h)).filter(r => o.events.includes(r.event)).sort(newestFirst)[0];
|
||||
const runs = [o.head, ...(o.also ?? [])].flatMap(h => deps.runsForHead(o.workflow, h)).filter(r => o.events.includes(r.event)).sort(newestFirst);
|
||||
const newest = runs.find(r => !(r.status === 'completed' && r.conclusion === 'skipped')) ?? runs[0];
|
||||
if (newest?.status === 'completed') {
|
||||
if (newest.conclusion === 'success') return { state: 'green', run: newest };
|
||||
const failing = deps.jobs(newest.id, newest.run_attempt).filter(j => !PASSING.includes(j.conclusion ?? '')).map(j => j.name);
|
||||
|
||||
+1
-1
@@ -223,7 +223,7 @@ export function verifyRun(deps: RunDeps, o: { repo: string; runRef: string; prof
|
||||
}
|
||||
const heads = [...new Set([run.head_sha, ...(o.vetoHeads ?? []).filter(h => SHA.test(h))])];
|
||||
for (const head of heads) {
|
||||
const newer = deps.runsForHead(p.workflow, head).filter(r => !(r.id === id && r.run_attempt === run.run_attempt) && r.id !== o.ignoreRun && started(r) >= (run.created_at ?? '') && !(r.status === 'completed' && r.conclusion === 'success'));
|
||||
const newer = deps.runsForHead(p.workflow, head).filter(r => !(r.id === id && r.run_attempt === run.run_attempt) && r.id !== o.ignoreRun && started(r) >= (run.created_at ?? '') && !(r.status === 'completed' && (r.conclusion === 'success' || r.conclusion === 'skipped')));
|
||||
if (newer.length) return fail('newer_run_vetoes', `newer run ${newer[0]!.id} of ${p.workflow} on ${head.slice(0, 12)} is ${newer[0]!.status === 'completed' ? newer[0]!.conclusion : newer[0]!.status}`);
|
||||
}
|
||||
if (p.skippable && p.skippable.jobs.every(j => skippedJobs.includes(j)) && o.docsOnly?.(run.head_sha)) {
|
||||
|
||||
Reference in new issue
Block a user