How to Bulk Delete GitHub Actions Workflow Runs
Want to bulk delete GitHub Actions workflow runs without clicking Delete until your mouse files a resignation letter? GitHub CLI can do the repetitive work. First, though, let’s make sure it only removes the runs you actually meant to remove.
This beginner-friendly guide covers installing GitHub CLI, signing in, finding your repository, previewing what will be removed, deleting old GitHub Actions runs or all completed runs, and checking whether any storage-heavy artifacts remain. For more repository housekeeping, browse our Git / GitHub tutorials.
Before you begin: Deletion is permanent. Removing a run deletes its logs and associated artifacts, which may be needed for debugging or audits. It does not delete your workflow YAML, repository code or future workflow schedules. Always preview before running a deletion command.
Step 1: Install GitHub CLI
GitHub CLI is the official command-line tool, invoked with gh. Open a terminal on macOS, Linux or Windows.
On macOS using Homebrew:
brew install ghOn Windows using winget (PowerShell):
winget install --id GitHub.cliFor Linux distributions or other installation options, use the official GitHub CLI installation page.
Confirm the installation:
gh --versionIf gh is not found, reopen the terminal and ensure the installation directory is on your PATH.
Step 2: Authenticate with GitHub
Yes, you need to sign in before using the authenticated Actions API or deleting workflow runs.
gh auth loginFollow the prompts: select GitHub.com, choose HTTPS when appropriate, and complete authentication in your browser. For a private repository or deletion, the account and credentials need appropriate Actions permissions. Organization policy may also restrict access.
Confirm that authentication worked:
gh auth statusNever share an access token or paste a token into a public issue, screenshot or tutorial.
Step 3: Identify the repository for GitHub Actions workflow runs
GitHub uses OWNER/REPO notation. For example, if your repository’s URL is https://github.com/octocat/Hello-World, its identifier is octocat/Hello-World.
All commands below use this illustrative identifier. Replace it with your actual repository, not the literal words OWNER/REPO.
To list recent runs:
gh run list --repo octocat/Hello-World --limit 20For each run, GitHub reports its status, title and other identifying details. Check that you have selected the correct repository before proceeding.
Step 4: Preview GitHub Actions workflow runs you want to remove
For a general overview including IDs and timestamps:
gh run list \
--repo octocat/Hello-World \
--status completed \
--limit 500 \
--json databaseId,createdAt,name \
--jq '.[] | [.databaseId, .createdAt, .name] | @tsv'Want to delete only older runs? Pick a UTC cutoff date and preview matches. The example below selects completed runs before 1 November 2026:
gh run list \
--repo octocat/Hello-World \
--status completed \
--limit 500 \
--json databaseId,createdAt,name \
--jq '.[] | select(.createdAt < "2026-11-01T00:00:00Z") | [.databaseId, .createdAt, .name] | @tsv'This is read-only. If the list looks wrong, stop and adjust the repository or cutoff. The limit applies to the runs retrieved before filtering; for very large histories, use additional pagination.
Step 5: Bulk-delete older GitHub Actions workflow runs
Once you have inspected the preview, use the matching filter to delete those runs:
gh run list \
--repo octocat/Hello-World \
--status completed \
--limit 500 \
--json databaseId,createdAt \
--jq '.[] | select(.createdAt < "2026-11-01T00:00:00Z") | .databaseId' > reviewed-run-ids.txt
cat reviewed-run-ids.txtReview the saved IDs and repository once more. The following command permanently deletes only the IDs in that file. If the preview command failed, do not continue. Run these commands in Bash, Git Bash or WSL.
while read -r id; do
[ -n "$id" ] || continue
gh run delete "$id" --repo octocat/Hello-World || break
done < reviewed-run-ids.txtEach deletion submits a request for a single run ID. The shell loop automates the command you could otherwise run manually. Keep the reviewed IDs in a file before deleting anything; do not fetch additional pages while deleting, because removing runs can shift subsequent pages. Stop at the first failed deletion, inspect the actual state, and rebuild the preview before resuming.
Windows note: These multiline Bash commands work in macOS Terminal, Linux shells, Git Bash and WSL. On Windows PowerShell, use Git Bash/WSL for the exact examples, or adapt the pipeline to PowerShell syntax.
Windows PowerShell: preview and delete a reviewed batch
PowerShell has its own loop syntax. Set your repository and cutoff, then save a bounded batch of completed runs. Check the exit code before using the result. This example fetches up to 500 matches; it is not a promise to cover an unlimited history.
$repo = "octocat/Hello-World"
$cutoff = "2026-11-01T00:00:00Z"
$json = gh run list --repo $repo --status completed --created "<$cutoff" --limit 500 --json databaseId,createdAt,name
if ($LASTEXITCODE -ne 0) { throw "Listing failed. Nothing deleted." }
$runs = @($json | ConvertFrom-Json)
$runs | Format-Table databaseId, createdAt, nameOnly after reviewing that table, type DELETE at the prompt below. This is the destructive step. The selected IDs remain in memory; do not close PowerShell between these steps.
if ((Read-Host "Type DELETE to remove these runs") -ne "DELETE") { throw "Cancelled" }
foreach ($run in $runs) {
gh run delete $run.databaseId --repo $repo
if ($LASTEXITCODE -ne 0) { throw "Deletion failed. Inspect state before continuing." }
}Step 6: Delete all completed GitHub Actions workflow runs (optional)
If you deliberately want to wipe the completed run history, first preview the IDs:
gh run list \
--repo octocat/Hello-World \
--status completed \
--limit 1000 \
--json databaseId \
--jq '.[].databaseId'Then, only if you intend to remove every returned completed run, execute:
gh run list \
--repo octocat/Hello-World \
--status completed \
--limit 1000 \
--json databaseId \
--jq '.[].databaseId' > reviewed-run-ids.txt
cat reviewed-run-ids.txtReview the saved IDs and repository once more. The following command permanently deletes only the IDs in that file. If the preview command failed, do not continue. Run these commands in Bash, Git Bash or WSL.
while read -r id; do
[ -n "$id" ] || continue
gh run delete "$id" --repo octocat/Hello-World || break
done < reviewed-run-ids.txtThis limits deletion to completed runs and at most 1,000 returned entries. Repeat the preview if there are more runs. A newly scheduled run can appear after the command; that does not mean the workflow was recreated. The workflow definition and its triggers were never removed.
Step 7: Verify GitHub Actions workflow runs after deletion
Count remaining runs:
gh run list \
--repo octocat/Hello-World \
--limit 1000 \
--json databaseId \
--jq 'length'If the result is 0, there were no runs in the returned list at that moment. If there are more than 1,000 runs, this is not a full-account count.
A useful distinction: workflow runs are execution records, workflow artifacts are uploaded files, and caches are dependency/build caches. They are not the same thing.
Step 8: Find what actually consumes Actions artifact storage
Deleting old runs may remove artifacts associated with those runs, but it is worth checking the retained files separately. This command lists every returned artifact with its name, size in bytes and creation date:
gh api --paginate \
repos/octocat/Hello-World/actions/artifacts \
--jq '.artifacts[] | [.name, .size_in_bytes, .created_at] | @tsv'Get the number of artifacts and approximate retained size:
gh api --paginate \
repos/octocat/Hello-World/actions/artifacts \
--jq '.artifacts[].size_in_bytes' |
awk '{sum += $1; count++} END {
printf "Artifacts: %d\n", count
printf "Total: %.2f MiB\n", sum / 1048576
}'Many tiny artifacts may be harmless, while a handful of large recurring test reports can account for most of the storage.
Step 9: Delete particular artifacts instead of their run history
If one artifact family is the problem, first list its IDs and sizes. In the example below, the artifact is called test-report; replace this with the exact name from your own results.
gh api --paginate \
repos/octocat/Hello-World/actions/artifacts \
--jq '.artifacts[] | select(.name == "test-report") | [.id, .size_in_bytes, .created_at] | @tsv'Deleting just one artifact, by ID:
gh api --method DELETE \
repos/octocat/Hello-World/actions/artifacts/ARTIFACT_IDReplace ARTIFACT_ID with a genuine ID. This removes the uploaded artifact but retains the associated workflow run entry and its logs.
To remove all artifacts with that exact name after checking they are disposable:
gh api --paginate \
repos/octocat/Hello-World/actions/artifacts \
--jq '.artifacts[] | select(.name == "test-report") | .id' > reviewed-run-ids.txt
cat reviewed-run-ids.txtReview the saved IDs and repository once more. The following command permanently deletes only the IDs in that file. If the preview command failed, do not continue. Run these commands in Bash, Git Bash or WSL.
while read -r id; do
[ -n "$id" ] || continue
gh api --method DELETE "repos/octocat/Hello-World/actions/artifacts/$id"
echo "Deleted artifact $id"
done < reviewed-run-ids.txtUse this only after confirming that no other jobs, releases or audits depend on the artifacts. They cannot be recovered afterward.
Check caches separately:
gh api repos/octocat/Hello-World/actions/cache/usageCache storage and artifact storage have distinct APIs and accounting rules. Don’t assume removing an artifact also clears its workflow caches.
Step 10: Stop artifacts from piling up again
Look in your repository’s .github/workflows/ directory for steps using actions/upload-artifact. If an artifact is truly temporary, set a shorter retention period:
- name: Upload test report
uses: actions/upload-artifact@v4
with:
name: test-report
path: reports/
retention-days: 3Retain the correct path for your workflow and choose a retention period appropriate for debugging and downstream dependencies. This example keeps the report for three days. It controls future uploads; it does not retroactively delete old artifacts.
Why does billing still show storage after deletion?
GitHub Actions storage is metered over time. The GB-hours figure represents accrued consumption, not how many gigabytes of files are currently in a repository.
Billing dashboards may also update later than the artifacts API. Deleting an artifact avoids additional storage accrual for that file, but does not erase already accrued usage. Therefore, checking the live artifact list is a better immediate way to confirm a cleanup.
You can view usage in GitHub billing settings under Actions, and configure spending controls in Budgets and alerts. A \$0 budget can block usage that would otherwise become billable, subject to its configuration, while included usage may still be available.
Frequently asked questions
Will deleting a workflow run stop my scheduled workflows? No. The workflows are defined by files in the repository and their configured triggers.
Will it delete my source code? No. Run deletion only removes the selected run history and its associated data.
Can I undo a deletion? No. Save anything you need first.
Why do I still have runs after deleting all completed runs? New scheduled runs may have started, some may still be in progress, or your query’s limit may not have covered the full history.
Is deleting workflow runs the same as deleting artifacts? No. Run deletion removes that run’s logs and related artifacts. Artifact deletion targets a particular stored file while leaving the run record.
Do I have to use GitHub CLI? No. The website allows deleting individual runs, but CLI makes bulk operations considerably easier.
GitHub Actions Runs: A Safe Cleanup Recap
For GitHub Actions runs, the safest sequence is: authenticate → list → preview → delete → verify. If the motivation is storage rather than a cluttered run history, inspect artifact sizes before deleting hundreds of runs. You might find that a few unusually large reports are responsible for nearly all the space.
Official references
– Install GitHub CLI – GitHub CLI authentication – List workflow runs – Delete a workflow run – GitHub Actions artifact API – GitHub billing settings




