mirror of
https://github.com/the-draupnir-project/Draupnir.git
synced 2026-06-02 13:54:02 +00:00
Please the all mighty linter
This commit is contained in:
+24
-12
@@ -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"}`,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user