Skip to content
Latchkey

How to Overwrite an Existing Artifact in GitHub Actions

v4 artifact names are immutable by default; set overwrite: true to delete and replace an existing one.

Because v4 fails when a name already exists, set overwrite: true on actions/upload-artifact@v4 to remove the prior artifact and upload the new one.

Steps

  • Add overwrite: true to the upload step.
  • The action deletes the existing same-named artifact, then uploads.
  • Prefer unique names in a matrix; use overwrite for reruns or single-name reports.

Workflow

.github/workflows/ci.yml
steps:
  - uses: actions/upload-artifact@v4
    with:
      name: latest-report
      path: report/
      overwrite: true

Gotchas

  • Without overwrite, a duplicate name fails with "an artifact with this name already exists".
  • Overwrite is not atomic: a failed rerun can leave you with no artifact briefly.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →