{"id":22940904,"url":"https://github.com/scottgriv/bash-github_delete_workflow_runs","last_synced_at":"2026-04-20T10:03:13.723Z","repository":{"id":215020153,"uuid":"737915831","full_name":"scottgriv/bash-github_delete_workflow_runs","owner":"scottgriv","description":"Mass delete all GitHub Actions workflow runs for a specific repository using GitHub CLI.","archived":false,"fork":false,"pushed_at":"2025-10-18T00:47:38.000Z","size":459,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-01T04:26:06.533Z","etag":null,"topics":["bash","bash-script","bash-utility","github","github-actions","github-cli","github-workflows","utility-application"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scottgriv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-01-02T00:19:14.000Z","updated_at":"2025-12-31T21:01:19.000Z","dependencies_parsed_at":"2026-02-14T20:04:21.142Z","dependency_job_id":null,"html_url":"https://github.com/scottgriv/bash-github_delete_workflow_runs","commit_stats":null,"previous_names":["scottgriv/bash-github_delete_workflow_runs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/scottgriv/bash-github_delete_workflow_runs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottgriv%2Fbash-github_delete_workflow_runs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottgriv%2Fbash-github_delete_workflow_runs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottgriv%2Fbash-github_delete_workflow_runs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottgriv%2Fbash-github_delete_workflow_runs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scottgriv","download_url":"https://codeload.github.com/scottgriv/bash-github_delete_workflow_runs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scottgriv%2Fbash-github_delete_workflow_runs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32042293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","bash-script","bash-utility","github","github-actions","github-cli","github-workflows","utility-application"],"created_at":"2024-12-14T13:33:17.509Z","updated_at":"2026-04-20T10:03:13.717Z","avatar_url":"https://github.com/scottgriv.png","language":"Shell","funding_links":["https://www.buymeacoffee.com/scottgriv"],"categories":[],"sub_categories":[],"readme":"\u003c!-- Begin README --\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://github.com/scottgriv/bash-github_delete_workflow_runs\" target=\"_blank\"\u003e\n        \u003cimg src=\"./docs/images/icon.png\" width=\"150\" height=\"150\"/\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.gnu.org/software/bash/manual/bash.html\"\u003e\u003cimg src=\"https://img.shields.io/badge/Bash-5.2.0-4EAA25?style=for-the-badge\u0026logo=gnubash\" alt=\"Bash Badge\" /\u003e\u003c/a\u003e\n    \u003cbr\u003e\n    \u003ca href=\"https://github.com/scottgriv\"\u003e\u003cimg src=\"https://img.shields.io/badge/github-follow_me-181717?style=for-the-badge\u0026logo=github\u0026color=181717\" alt=\"GitHub Badge\" /\u003e\u003c/a\u003e\n    \u003ca href=\"mailto:scott.grivner@gmail.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/gmail-contact_me-EA4335?style=for-the-badge\u0026logo=gmail\" alt=\"Email Badge\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.buymeacoffee.com/scottgriv\"\u003e\u003cimg src=\"https://img.shields.io/badge/buy_me_a_coffee-support_me-FFDD00?style=for-the-badge\u0026logo=buymeacoffee\u0026color=FFDD00\" alt=\"BuyMeACoffee Badge\" /\u003e\u003c/a\u003e\n    \u003cbr\u003e\n    \u003ca href=\"https://prgportfolio.com\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/PRG-Bronze Project-CD7F32?style=for-the-badge\u0026logo=data:image/svg%2bxml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDIwMDEwOTA0Ly9FTiIKICJodHRwOi8vd3d3LnczLm9yZy9UUi8yMDAxL1JFQy1TVkctMjAwMTA5MDQvRFREL3N2ZzEwLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4wIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiB3aWR0aD0iMjYuMDAwMDAwcHQiIGhlaWdodD0iMzQuMDAwMDAwcHQiIHZpZXdCb3g9IjAgMCAyNi4wMDAwMDAgMzQuMDAwMDAwIgogcHJlc2VydmVBc3BlY3RSYXRpbz0ieE1pZFlNaWQgbWVldCI+Cgo8ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgwLjAwMDAwMCwzNC4wMDAwMDApIHNjYWxlKDAuMTAwMDAwLC0wLjEwMDAwMCkiCmZpbGw9IiNDRDdGMzIiIHN0cm9rZT0ibm9uZSI+CjxwYXRoIGQ9Ik0xMiAzMjggYy04IC04IC0xMiAtNTEgLTEyIC0xMzUgMCAtMTA5IDIgLTEyNSAxOSAtMTQwIDQyIC0zOCA0OAotNDIgNTkgLTMxIDcgNyAxNyA2IDMxIC0xIDEzIC03IDIxIC04IDIxIC0yIDAgNiAyOCAxMSA2MyAxMyBsNjIgMyAwIDE1MCAwCjE1MCAtMTE1IDMgYy04MSAyIC0xMTkgLTEgLTEyOCAtMTB6IG0xMDIgLTc0IGMtNiAtMzMgLTUgLTM2IDE3IC0zMiAxOCAyIDIzCjggMjEgMjUgLTMgMjQgMTUgNDAgMzAgMjUgMTQgLTE0IC0xNyAtNTkgLTQ4IC02NiAtMjAgLTUgLTIzIC0xMSAtMTggLTMyIDYKLTIxIDMgLTI1IC0xMSAtMjIgLTE2IDIgLTE4IDEzIC0xOCA2NiAxIDc3IDAgNzIgMTggNzIgMTMgMCAxNSAtNyA5IC0zNnoKbTExNiAtMTY5IGMwIC0yMyAtMyAtMjUgLTQ5IC0yNSAtNDAgMCAtNTAgMyAtNTQgMjAgLTMgMTQgLTE0IDIwIC0zMiAyMCAtMTgKMCAtMjkgLTYgLTMyIC0yMCAtNyAtMjUgLTIzIC0yNiAtMjMgLTIgMCAyOSA4IDMyIDEwMiAzMiA4NyAwIDg4IDAgODggLTI1eiIvPgo8L2c+Cjwvc3ZnPgo=\" alt=\"Bronze\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---------------\n\n\u003ch1 align=\"center\"\u003eGitHub CLI - Delete GitHub Actions Workflow Runs\u003c/h1\u003e\n\nHave you ever wanted to clean-up and delete past GitHub Actions Workflow Runs/Logs but did not want to click on each run individually to delete it?\n\nWell, save some time and utilize GitHub CLI to mass delete all GitHub Actions workflow runs for a specific repository!\n\n---------------\n\n## Table of Contents\n\n- [Features](#features)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Resources](#resources)\n- [License](#license)\n- [Credits](#credits)\n\n## Features\n\nThis repository contains a Bash file `delete_workflow_runs.sh`, which will delete **ALL** workflow runs for a specific repository when executed.\n\n## Installation\n\n1. **Install GitHub CLI (gh):** This tool allows you to interact with GitHub from the command line. You can install it using Homebrew on your Mac with the command ```brew install gh```.\n\n2. **jq Tool:** This is a command-line JSON processor that the script uses to parse JSON data. Install it on your Mac using Homebrew with the command ```brew install jq```.\n\n3. **GitHub Authentication:** To use the GitHub CLI (gh), you need to be authenticated. You don't necessarily need an API key; instead, you authenticate your GitHub CLI installation with your GitHub account. Once installed, you can authenticate by running ```gh auth login``` and following the prompts.\n\n4. **Create the File:** Use a text editor to create a new file with the script inside it.\n\n5. **Make It Executable:** Before you can run your Bash script, you need to make it executable. You can do this from the terminal with the following command:\n\n```bash\nchmod +x delete_workflow_runs.sh\n```\n\nAfter setting up these prerequisites, you can run your script. Here's the script for reference:\n\n```bash\ngh api --paginate /repos/username/reponame/actions/runs | \\\njq -r '.workflow_runs[] | [.id] | @tsv' | \\\nwhile read -r value; do \n    echo \"Deleting $value\"\n    gh api -X DELETE \"/repos/username/reponame/actions/runs/$value\"\ndone\n```\n\n\u003e [!IMPORTANT]\n\u003e Remember to replace ```username``` and ```reponame``` with your GitHub username and the repository name, respectively.\n\n## Usage\n\n**This script works by:** \n- Using the GitHub CLI to fetch a list of workflow runs for a specific repository.\n- Piping the output to jq to extract the run IDs.\n- Looping over each ID and using the GitHub CLI to delete the corresponding workflow run.\n\n**Pagination**\n- By default, the script is only deleting 25 workflow runs at a time, this is likely due to the GitHub API's pagination feature. \n- The GitHub API, like many APIs, uses pagination to limit the number of items returned in a single response. This is done to manage load on the server and to ensure faster response times. \n- The GitHub CLI (gh) simplifies pagination with the ```--paginate``` flag which is written into the script. With the ```--paginate``` flag, the script will loop through each page of the API response until there are no more pages left.\n\n**Running the Script:** Once the script is executable, you can run it from the terminal in the directory where the script is located:\n\n```bash\n./delete_workflow_runs.sh\n```\n\n## Resources\n\n- [GitHub CLI Tool](https://cli.github.com/)\n- [Mass deletion of GitHub Actions workflow runs (a blog post that inspired me to tackle this problem)](https://qmacro.org/blog/posts/2021/03/26/mass-deletion-of-github-actions-workflow-runs/)\n- [Bash Reference Manual](https://www.gnu.org/software/bash/manual/bash.html)\n- [Bash Guide for Beginners](https://tldp.org/LDP/Bash-Beginners-Guide/html/index.html)\n- [Bash Scripting Tutorial](https://ryanstutorials.net/bash-scripting-tutorial/)\n- [Bash Scripting Cheatsheet](https://devhints.io/bash)\n\n## License\n\nThis project is released under the terms of **The Unlicense**, which allows you to use, modify, and distribute the code as you see fit. \n- [The Unlicense](https://choosealicense.com/licenses/unlicense/) removes traditional copyright restrictions, giving you the freedom to use the code in any way you choose.\n- For more details, see the [LICENSE](LICENSE) file in this repository.\n\n## Credits\n\n**Author:** [Scott Grivner](https://github.com/scottgriv) \u003cbr\u003e\n**Email:** [scott.grivner@gmail.com](mailto:scott.grivner@gmail.com) \u003cbr\u003e\n**Website:** [linktr.ee/scottgriv](https://www.linktr.ee/scottgriv) \u003cbr\u003e\n**Reference:** [Main Branch](https://github.com/scottgriv/bash-github_delete_workflow_runs) \u003cbr\u003e\n\n---------------\n\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://linktr.ee/scottgriv\" target=\"_blank\"\u003e\n        \u003cimg src=\"./docs/images/footer.png\" width=\"100\" height=\"100\"/\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\n\u003c!-- End README --\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscottgriv%2Fbash-github_delete_workflow_runs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscottgriv%2Fbash-github_delete_workflow_runs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscottgriv%2Fbash-github_delete_workflow_runs/lists"}