Delete artifacts

 Since now limits and pricing for storage were introduced, it would make sense to have some feature to delete artifacts for old builds.

Also in some cases you want artifacts to persist only for the duration of the workflow, as a means to share files between jobs, and in this case you don’t need these artifacts afterwards. So it would be good to have some artifact-cleanup action, which would remove created artifacts for that workflow.


Hi @paulius-p,

Thanks for being here! As of now there’s not a way to delete artifacts from the UI nor is there a way to store artifacts for less than 90 or 30 days. We’ve passed your feedback and information on to the Actions product team for future consideration.


Hi @andreagriffiths11 
My team is now blocked because we’ve reacthed the artifacts limit.
Is there a way to delete artifacts via the Github API ?
I looked at the Github Docs  and couldn’t find any documentation on actions.

1 Like

Hey @andreagriffiths11 ,

My team is also being blocked, with all our pipelines (that uses artifacts) breaking. Seems to me as a big issue because I’m getting blocked and there seems no way for us to move forward.

Is the engineering team able to give us a way to delete these objects (even it means purging it all at once), or temporarily disable this rule enforcement until they are ready?



+1 We are also blocked.

1 Like

Hi, we moved all our CI to Github actions and took a paid plan and now we’re blocked because we can’t delete artifacts. It’s fair to ask to pay for storage, but there needs to be a way to delete files, like any storage service. 

1 Like

Thanks for sharing your problems with this. The team is working on a solution for it.


+1 for this feature request.  I also only need artifacts to last the duration of the workflow, and am now blocked because I’ve reached the limit.


Well, we are a company so we are just raising the spending limit but we feel a bit cheated :slight_smile:

UI + API for this will be available soon.


It would be totally cool, if the artifact gets deleted after a merge, e.g. when the branch gets deleted.

1 Like

I also vote for a more flexible artifact retention duration. I just setup nightly builds on my open source project. I certainly do not need those nightly builds to be retained for 90 days. Keeping the last 5 days (or so) is sufficient,

The current retention time should be a default one and a maximum one. But a shorter period should be allowed, either in the settings of the repo or on an artifact basis, for instance something like this:

- name: Upload build
      uses: actions/upload-artifact@master
        name: installer
        path: installer.exe
        retention-days: 5

Another type of retention that would be VERY useful would be to delete artifacts after the workflow has completed. This is useful when one job builds temporary assets used by other jobs but the artifacts shouldn’t persist after the workflow is complete.


Hi all,

We recently shipped an Artifacts API that includes a delete endpoint. Here are the docs: It works with the GITHUB_TOKEN from within Actions, so you could have an Action that deletes artifacts for you.

We now also have the ability to delete artifacts from the UI (on the logs page, top right corner).


Thank you for the Actions and Artifacts API. I started to use it and it is great !

In addition to that, which requires manual or API-programmed actions, it would be very useful to be able to define a shorter retention time for artifacts so that the deletion is automatic after some user-defined duration.

Hi mscoutermarsh, just tried to use the following action in a final actions:

curl -H "Authorization: token ${{secrets.SHARED_REPO_ACCESS}}" "${{github.repository}}/actions/runs/${{github.run_id}}/artifacts" | jq ".artifacts | .[] | .id" | tee artefacts
cat artefacts | xargs -n1 -i curl -H "Authorization: token ${{secrets.SHARED_REPO_ACCESS}}" -X DELETE "${{github.repository}}/actions/artifacts/{}"

Which i thought would cleanup any artefacts from the currently running workflow. But it seems /artefacts is returning empty during the workflow run. Is there anyway around that?

Just checked and currently no.

The runner doesn’t “record” the Artifacts until the job completes. Once the job is completed, then they are available in the API.

1 Like

Bummer. Was hoping to use this API to cleanup after a workflow is done. Will need to just run a cron to do this on a regular basis.

1 Like

Maybe if we had an easy way to trigger a workflow once another workflow completes, we could also do that. All this seems like a pretty dumb workaround for maybe just some custom artefact expiry times.

1 Like

Since this is is probably a very common requirement, I have written a small Gist named “Purging old artifacts with GitHub Actions API” with a sample script.