Skip to content
You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
trash-2

GitHub Action

Delete Artifact

v2.0.0

Delete Artifact

trash-2

Delete Artifact

Delete artifacts created within the workflow run

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Delete Artifact

uses: GeekyEggo/[email protected]

Learn more about this action in GeekyEggo/delete-artifact

Choose a version

Example

Delete artifacts

A GitHub Action for deleting artifacts within the workflow run. This can be useful when artifacts are shared across jobs, but are no longer needed when the workflow is complete.

⚡ Usage

See action.yml

Warning From version 2 onwards, glob (wildcard) support is on by default, and is fulfilled by minimatch; this can be disabled by setting useGlob to false.

Delete an individual artifact

steps:
    - uses: actions/checkout@v2

    - run: echo hello > world.txt

    - uses: actions/upload-artifact@v2
      with:
          name: my-artifact
          path: world.txt

    # delete-artifact
    - uses: geekyeggo/delete-artifact@v2
      with:
          name: my-artifact

Specify multiple names

steps:
    - uses: geekyeggo/delete-artifact@2
      with:
          name: |
              artifact-*
              binary-file
              output

🚨 Error vs Fail

By default, the action will fail when it was not possible to delete an artifact (with the exception of name mismatches). When the deletion of an artifact is not integral to the success of a workflow, it is possible to error without failure. All errors are logged.

steps:
    - uses: geekyeggo/delete-artifact@v2
      with:
          name: okay-to-keep
          failOnError: false

⚠ Disclaimer

This action utilizes a preview version of GitHub's runtime API; the API is subject to change at any time which may result in failures of this action.