From 2c4e113dd7b340c8fcd257d127b8980c9bb8e9fc Mon Sep 17 00:00:00 2001 From: Liangsheng Yin Date: Wed, 8 Apr 2026 17:17:07 -0700 Subject: [PATCH] [CI] Fast-fail on lint check failure in check-stage-health (#22400) --- .github/actions/check-stage-health/action.yml | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/actions/check-stage-health/action.yml b/.github/actions/check-stage-health/action.yml index 4416ebc08..536b3ad3f 100644 --- a/.github/actions/check-stage-health/action.yml +++ b/.github/actions/check-stage-health/action.yml @@ -1,5 +1,5 @@ name: Check Stage Health -description: Fail fast if any job in the current workflow run has already failed. Auto-skips for scheduled runs. +description: Fail fast if any job in the current workflow run has already failed, or if the lint check (from lint.yml) has failed. Auto-skips for scheduled runs. inputs: github-token: @@ -29,6 +29,24 @@ runs: return; } + // Check lint status from the separate Lint workflow (lint.yml). + // listJobsForWorkflowRun only sees jobs within the SAME run, so we use + // checks.listForRef which queries by commit SHA across ALL workflows. + const ref = context.payload.pull_request?.head?.sha || context.sha; + const { data } = await github.rest.checks.listForRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: ref, + check_name: 'lint', + }); + const lintRun = data.check_runs.find( + cr => cr.app?.slug === 'github-actions' + ); + if (lintRun?.status === 'completed' && lintRun?.conclusion === 'failure') { + core.setFailed('Fast-fail: lint check failed'); + return; + } + const jobs = await github.paginate(github.rest.actions.listJobsForWorkflowRun, { owner: context.repo.owner, repo: context.repo.repo,