Last active
January 17, 2025 00:21
-
-
Save TerrorJack/e0e886b87b9bfffb6c5fa5b3aeddcecc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env -S deno run --allow-env --allow-net | |
import { Gitlab } from "npm:@gitbeaker/[email protected]"; | |
const api = new Gitlab({ | |
host: "https://gitlab.haskell.org", | |
token: Deno.env.get("GITLAB_TOKEN"), | |
}); | |
async function cancel(projectId, pipelineId) { | |
const jobs = ( | |
await api.Jobs.all(projectId, { | |
pipelineId, | |
perPage: 100, | |
}) | |
).filter((job) => job.stage === "full-build" && !job.name.includes("wasm")); | |
for (const job of jobs) { | |
try { | |
await api.Jobs.cancel(projectId, job.id); | |
console.log(`[INFO] Cancelled ${job.name}`); | |
} catch (err) { | |
console.warn(`[WARN] Error cancelling ${job.name}: ${err}`); | |
} | |
} | |
} | |
await cancel(Deno.env.get("CI_PROJECT_ID"), Deno.env.get("CI_PIPELINE_ID")); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment