@@ -105,28 +105,72 @@ jobs:
105105 console.log(`Found open milestone ${process.env.GEM_VERSION} (ID: ${versionMilestone.number})`);
106106
107107 # Check if the commit has passed all Github checks
108- # API: https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28#list-check-runs-for-a-git-reference
108+ # API:
109+ # - https://docs.github.com/en/rest/checks/suites?apiVersion=2022-11-28#list-check-suites-for-a-git-reference
110+ # - https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28#list-check-runs-in-a-check-suite
109111 - name : Verify check runs
110112 continue-on-error : ${{ inputs.force }}
113+ env :
114+ APP_ID : 15368 # Github Actions app ID
111115 uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
112116 with :
113117 script : |
114- const checkRuns = await github.paginate(github.rest.checks.listForRef , {
118+ const checkSuites = await github.paginate(github.rest.checks.listSuitesForRef , {
115119 owner: context.repo.owner,
116120 repo: context.repo.repo,
117121 ref: context.sha,
122+ app_id: parseInt(process.env.APP_ID),
118123 per_page: 100
119124 });
120125
121- const failedChecks = checkRuns.filter(check =>
122- check.status === 'completed' &&
123- check.conclusion !== 'success' &&
124- check.conclusion !== 'skipped'
126+ console.log(`Found ${checkSuites.length} check suites`);
127+
128+ // Filter for failed check suites
129+ // Valid conclusions that indicate success or can be ignored:
130+ // - success: everything passed
131+ // - neutral: checks completed without detecting any specific issues
132+ // - skipped: checks were intentionally skipped (aka not relevant)
133+ const failedSuites = checkSuites.filter(suite =>
134+ suite.status === 'completed' &&
135+ suite.conclusion !== 'success' &&
136+ suite.conclusion !== 'neutral' &&
137+ suite.conclusion !== 'skipped'
125138 );
126139
127- if (failedChecks.length > 0) {
128- const failedNames = failedChecks.map(c => c.name).join(', ');
129- core.setFailed(`Check runs failed: ${failedNames}`);
140+ if (failedSuites.length > 0) {
141+ console.log(`Found ${failedSuites.length} failed check suites`);
142+
143+ // Get failed check runs for all failed suites using Promise.all and map
144+ const failedChecksPromises = failedSuites.map(async suite => {
145+ const checkRuns = await github.paginate(github.rest.checks.listForSuite, {
146+ owner: context.repo.owner,
147+ repo: context.repo.repo,
148+ check_suite_id: suite.id,
149+ per_page: 100
150+ });
151+
152+ return checkRuns.filter(check =>
153+ check.status === 'completed' &&
154+ check.conclusion !== 'success' &&
155+ check.conclusion !== 'neutral' &&
156+ check.conclusion !== 'skipped'
157+ );
158+ });
159+
160+ const failedChecksArrays = await Promise.all(failedChecksPromises);
161+ const allFailedChecks = failedChecksArrays.flat();
162+
163+ console.log(`Found a total of ${allFailedChecks.length} failed check runs`);
164+
165+ // Annotate each failed check run
166+ allFailedChecks.forEach(check => {
167+ core.error(`Debug URL: ${check.html_url || check.details_url}`, {
168+ title: `Failed Check: ${check.name}`,
169+ });
170+ });
171+
172+ // Set job failure
173+ core.setFailed(`Found ${failedSuites.length} failed check suites`);
130174 }
131175
132176 # Check if the commit has passed external CI checks
0 commit comments