actions / upload-artifact

MIT License
3.01k stars 683 forks source link

Ability to overwrite an Artifact #501

Closed robherley closed 5 months ago

robherley commented 5 months ago

Closes: https://github.com/github/actions-results-team/issues/2144 Addresses: https://github.com/actions/upload-artifact/issues/471

This adds a new overwrite input to the action that will delete any matching artifacts by name before uploading a new artifact.

e.g.

jobs:
  upload:
    runs-on: ubuntu-latest
    steps:
      - name: Create a file
        run: echo "hello world" > my-file.txt
      - name: Upload Artifact
        uses: actions/upload-artifact@v4
        with:
          name: my-artifact # NOTE: same artifact name
          path: my-file.txt
  upload-again:
    needs: upload
    runs-on: ubuntu-latest
    steps:
      - name: Create a different file
        run: echo "goodbye world" > my-file.txt
      - name: Upload Artifact
        uses: actions/upload-artifact@v4
        with:
          name: my-artifact # NOTE: same artifact name
          path: my-file.txt
          overwrite: true
robherley commented 5 months ago

Please ignore the 100s of files changed in .licenses, we should fix that versioning w/ CI 😅