Your Search Bar For Shrewd Tips

How Do I Clear Github Actions Storage?


GitHub Actions storage can grow quickly when workflows generate large artifacts, retain logs for months, or create many cache entries. If you are seeing a storage warning or unexpected usage on your GitHub bill, clearing old Actions data can help. The right cleanup method depends on what is using space: workflow runs and their logs, uploaded artifacts, or dependency caches.

This guide explains how to clear GitHub Actions storage using the GitHub website, GitHub CLI, and API. It also covers retention settings and practical ways to prevent storage from filling up again. Before deleting anything, check which repositories and data types are using space so you can remove what is no longer needed without losing useful build outputs.

What Uses GitHub Actions Storage?

GitHub Actions storage is commonly used by three kinds of data. They are managed differently, so it helps to identify the source of your usage first:

  • Workflow logs and run data: GitHub keeps information about workflow runs, including their logs. Deleting a workflow run also deletes its associated logs and artifacts.
  • Workflow artifacts: Workflows can upload files such as test reports, packaged applications, and build outputs. These remain stored until they expire or are deleted.
  • Actions caches: Caches save dependencies or other reusable files to make future workflow runs faster. Caches are separate from workflow artifacts and can be cleared independently.

Storage and billing rules can differ based on your GitHub plan and whether a repository belongs to an organization. You can review current usage and included allowances in your account or organization billing settings. If usage does not appear to change immediately after cleanup, allow time for GitHub’s usage reporting to update.

Check What Is Taking Up Space

Start by checking your account or organization’s billing and usage pages. Look for GitHub Actions storage usage, then identify the repositories contributing most to it. In a repository, you can also inspect recent workflow runs, artifacts, and cache entries to find old or unusually large data.

To review workflow artifacts, open the repository on GitHub and select Actions. Choose a workflow run and look for its artifacts. To review caches, open the repository’s Settings and find the Actions cache management area. GitHub’s interface can change, so the exact labels or page locations may vary.

Make a note of any artifacts that need to be kept before deleting workflow runs. A run deletion can remove its logs and artifacts together, which may affect debugging, audits, or a release process that still depends on a stored build.

Delete Workflow Runs, Logs, and Artifacts

Deleting an old workflow run is a straightforward way to remove its associated logs and artifacts. This is useful when a run is obsolete or its output has already been downloaded or published elsewhere.

  • Open the repository and select Actions.
  • Choose the workflow run you want to remove.
  • Open the run’s options menu, then select the delete option.
  • Confirm the deletion when prompted.

Deleting a run is generally permanent. If you need to preserve an artifact, download it or move it to an appropriate long-term storage location before removing the run. Also check whether your team needs the logs for troubleshooting or compliance purposes.

You can delete a run with the GitHub CLI if it is installed and authenticated with an account that has sufficient repository permissions. First list recent runs:

gh run list --repo OWNER/REPOSITORY

Then delete a specific run by its ID:

gh run delete RUN_ID --repo OWNER/REPOSITORY

Replace OWNER/REPOSITORY and RUN_ID with the correct values. Review the ID carefully before running the command, especially when scripting deletions across several repositories.

Delete Individual Artifacts

If you want to keep a workflow run and its logs but remove a particular artifact, delete the artifact on its own instead of deleting the entire run. In the repository’s Actions area, open the relevant run and find the artifact you no longer need. Use the artifact’s delete control if it is available in the interface.

For automation, GitHub provides a REST API endpoint to delete an artifact by its artifact ID. The endpoint is DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}. Your token needs appropriate repository access, and the request must use an API version supported by GitHub. Consult GitHub’s current REST API documentation for authentication requirements and examples.

Artifact deletion is useful for removing large outputs while retaining the run history. However, if a workflow creates many disposable artifacts, changing the workflow to avoid uploading them—or to upload only required files—can be more effective than repeatedly deleting them afterward.

Clear GitHub Actions Caches

Caches are not the same as artifacts. A cache stores reusable files, often package-manager dependencies, so later jobs can run faster. Removing a cache usually does not delete a workflow run or its artifacts, but the next workflow may take longer while it rebuilds or downloads those files again.

To remove caches through GitHub’s website, open the repository’s Settings and locate the Actions cache management page. Review the listed cache entries and delete the ones that are stale, unnecessary, or associated with old branches. The available controls and page layout may differ as GitHub updates its interface.

You can also use the GitHub CLI to inspect cache entries:

gh cache list --repo OWNER/REPOSITORY

Delete a particular cache by its ID:

gh cache delete CACHE_ID --repo OWNER/REPOSITORY

Check the installed CLI’s help output for supported options, such as whether your version allows deleting all caches in one command:

gh cache delete --help

For custom cleanup scripts, GitHub’s REST API includes endpoints for listing and deleting repository caches. You can delete a cache by ID, or use supported key and ref filters where appropriate. Use the current API documentation to confirm the exact endpoint, parameters, and token permissions before automating cache removal.

Be cautious with broad cache deletion. Removing every cache at once may free space, but it can cause a temporary slowdown across workflows as dependencies are fetched and caches are recreated. If a specific branch or dependency is responsible for the storage growth, target those entries instead.

Set Retention Periods to Prevent Future Growth

GitHub lets repository and organization administrators control how long workflow artifacts and logs are retained, subject to GitHub’s limits and the applicable plan. Shortening retention can prevent old data from accumulating. In a repository, review Settings, then the Actions general settings, and find the artifact and log retention setting.

Organizations may also have a retention policy that applies across repositories. If a repository-level setting is unavailable or cannot be increased, an organization policy may be controlling it. Ask an organization owner to review the relevant settings. Choose a period that balances storage needs with your team’s requirements for debugging, releases, and recordkeeping.

Retention settings generally affect future cleanup according to the configured policy; they are not a substitute for manually deleting data you need removed now. If you change retention, check the current behavior in GitHub’s documentation and verify the setting at both repository and organization levels.

Reduce Storage in Workflow Files

The most reliable way to manage Actions storage is to prevent unnecessary data from being created. Review workflow files for artifact upload steps and cache configuration. Ask whether each uploaded file is needed after the run, whether it can be smaller, and whether every branch needs to keep a separate copy.

  • Upload only the files required by teammates, releases, or later jobs.
  • Exclude temporary files, dependency folders, and duplicate build outputs.
  • Use artifact retention settings on upload steps when a shorter lifetime is appropriate.
  • Use cache keys thoughtfully so small changes do not create excessive redundant entries.
  • Remove obsolete workflows that continue producing artifacts or caches.

For example, an artifact upload action can specify a retention period using its supported retention input. Check the action’s documentation for the exact input name and limits, since these can change. A shorter artifact lifetime is often a good choice for temporary test reports, while release packages may need to be stored somewhere designed for long-term distribution.

Common Problems When Clearing Actions Storage

You cannot see a delete option. Your account may lack the required repository role or permission. Ask a repository administrator or organization owner to perform the cleanup or grant the appropriate access.

Storage usage has not changed yet. Billing and storage dashboards may not update immediately. Confirm that the correct data was deleted, then check the usage page again later. If the reported amount remains unexpectedly high, inspect other repositories and distinguish caches from artifacts and logs.

A cache returns after deletion. A workflow may have recreated it during a later run. Review cache keys and workflow triggers, then adjust the workflow if it is generating unnecessary entries.

Workflows become slower after cleanup. This is expected when useful dependency caches are removed. Allow workflows to rebuild the caches, or restore only the cache strategy your team needs.

Conclusion

To clear GitHub Actions storage, first identify whether the space is being used by workflow logs, artifacts, or caches. Delete outdated workflow runs to remove their associated data, remove individual artifacts when you need to preserve run history, and clear stale caches through repository settings, the GitHub CLI, or the REST API. Then set sensible retention periods and adjust workflows so they create only the data you need.

Use care with permanent deletions, especially when artifacts or logs support releases, audits, or debugging. A targeted cleanup, combined with a practical retention policy, can reduce GitHub Actions storage without unnecessarily disrupting your development workflow.


Disclaimer: Articles are written by Humans, AI or Both. Verify Important information.

Shrewdnia

Shrewdnia

Shrewdnia is a destination for curious minds seeking clarity, knowledge, and informed perspectives. Through insightful articles and practical guides our passionate team explores a wide range of topics designed to help readers understand the world around them, make smarter decisions, and stay informed in an ever-changing landscape.


💡 Every question sparks discovery, and every perspective enriches the conversation. Share your thoughts and insights in the comments 👇

Back to blog

Leave a comment

JOIN THE SHREWDNIA COMMUNITY FORUM

What do you think?

Have an opinion, experience, or question about this topic? Join the Shrewdnia Forum and share your thoughts with other readers.

Join the Forum →