Skip to content

Instantly share code, notes, and snippets.

@SteffenL
Created April 13, 2024 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SteffenL/686ad0d62279f3bc3127188f070c8ba5 to your computer and use it in GitHub Desktop.
Save SteffenL/686ad0d62279f3bc3127188f070c8ba5 to your computer and use it in GitHub Desktop.
Delete GitHub Actions workflow runs easily from the web browser
// Quickly deletes GitHub Actions workflow runs using the GitHub web user interface using a web browser and scripting.
// Tested on 2024-04-13.
// 1. Go to a cluttered GitHub Actions workflow runs listing page,
// e.g. https://github.com/OWNER/REPO/actions/workflows/ci.yaml.
// 2. Make absolutely sure you want to delete all of the workflow runs on the currently loaded page.
// 3. Paste the following snippet into the web browser's JavaScript console.
// 4. Wait a brief moment for "Done" to appear in the console.
// 5. Reload the page or navigate to another page.
// 6. Repeat if needed.
Promise.all(
[...document.querySelectorAll("form")]
.filter(e => e.action.includes("/actions/runs/") && e.method === "post")
.filter(e => e._method && e._method.value === "delete")
.map(e => fetch(e.action, { method: "POST", body: new FormData(e) }))
).then(() => console.log("Done")).catch(console.error)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment