Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove github actions artifact produced during runtime

During workflow execution, I produce several artifacts but after a successful build I no longer need them and I want to clean that up as I only need them temporarily.

- name: Make artifact available to use
        uses: actions/upload-artifact@v2
        with:
          name: setup
          path: setup.yml

As a part of a different job I need artifacts so I also have

- name: Download yaml file
        uses: actions/download-artifact@v2
        with:
          name: setup

How can I add a step in the workflow (in my case, the last step) that's gonna remove these artifacts that were produced during runtime?

like image 292
hmdevno Avatar asked May 31 '26 10:05

hmdevno


1 Answers

There are delete artifact actions on the marketplace that could help you with that.

Example with this one:

steps:
- uses: actions/checkout@v3

- run: echo hello > world.txt

- name: Make artifact available to use
  uses: actions/upload-artifact@v2
  with:
    name: setup
    path: world.txt

# delete-artifact
- uses: geekyeggo/delete-artifact@v1
  with:
    name: setup

I made a workflow run example here if you want to have a look.

like image 143
GuiFalourd Avatar answered Jun 02 '26 03:06

GuiFalourd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!