diff --git a/.github/scripts/gate.js b/.github/scripts/gate.js index 6bf11f4f..ab3452a7 100644 --- a/.github/scripts/gate.js +++ b/.github/scripts/gate.js @@ -15,33 +15,45 @@ module.exports = async ({ github, context }) => { // Filter out the gate itself and third-party checks const knownWorkflows = [ - 'GHCR - Development Branches', 'Docker Hub - Release', 'Docker Hub - Latest', 'Docker Hub - Develop', - 'GHCR - Release', 'Tests', 'GHCR - Latest', 'Contribution requirements' + "GHCR - Development Branches", + "Docker Hub - Release", + "Docker Hub - Latest", + "Docker Hub - Develop", + "GHCR - Release", + "Tests", + "GHCR - Latest", + "Contribution requirements", ]; - const relevantChecks = checks.data.check_runs.filter(check => knownWorkflows.includes(check.name)); + const relevantChecks = checks.data.check_runs.filter((check) => + knownWorkflows.includes(check.name) + ); // Check if ANY workflow is still running or queued - const incompleteChecks = relevantChecks.filter(check => check.status !== 'completed'); + const incompleteChecks = relevantChecks.filter( + (check) => check.status !== "completed" + ); if (incompleteChecks.length > 0) { - console.log(`Waiting on ${incompleteChecks.length} checks... exiting for now.`); + console.log( + `Waiting on ${incompleteChecks.length} checks... exiting for now.` + ); return; } // Exclude skipped from failing the gate, treat success/neutral/skipped as OK - const allPassed = relevantChecks.every(check => - ['success', 'neutral', 'skipped'].includes(check.conclusion) + const allPassed = relevantChecks.every((check) => + ["success", "neutral", "skipped"].includes(check.conclusion) ); await github.rest.checks.create({ owner: context.repo.owner, repo: context.repo.repo, - name: 'Workflow Gate', + name: "Workflow Gate", head_sha: sha, - status: 'completed', - conclusion: allPassed ? 'success' : 'failure', + status: "completed", + conclusion: allPassed ? "success" : "failure", output: { - title: 'Workflow Status', - summary: `${relevantChecks.length} workflow(s) evaluated: ${allPassed ? '✅ all passed' : '❌ some failed'}`, + title: "Workflow Status", + summary: `${relevantChecks.length} workflow(s) evaluated: ${allPassed ? "✅ all passed" : "❌ some failed"}`, }, }); };