Skip to content
Latchkey

actions/upload-artifact

Upload files from a job so other jobs or a person can download them after the run.

Official actionCategory: ArtifactsLatest v4View on GitHub

What it does

actions/upload-artifact persists files produced by a job so a later job can download them or a human can grab them from the run summary.

v4 rewrote the backend for speed and immutability, and it is not cross-compatible with v3: both ends of an upload/download pair must be on v4.

Usage

workflow (.yml)
steps:
  - uses: actions/upload-artifact@v4
    with:
      name: test-results
      path: reports/
      retention-days: 7

Inputs

InputDescriptionDefaultRequired
nameArtifact name.artifactNo
pathFile, directory, or glob to upload.-Yes
if-no-files-foundBehavior when nothing matches: warn, error, or ignore.warnNo
retention-daysDays to keep the artifact (up to the repo maximum).repo defaultNo
overwriteReplace an existing artifact of the same name.falseNo

Outputs

OutputDescription
artifact-idNumeric id of the uploaded artifact.
artifact-urlURL of the artifact in the run.

Notes

In v4 an artifact name is immutable within a run. Uploading the same name twice fails unless overwrite: true.

To collect artifacts from a matrix, give each leg a unique name (for example include the matrix value) and merge on download.

Common errors

  • Conflict: an artifact with this name already exists on the workflow run (v4) means a duplicate name. Use unique names or overwrite: true.
  • Mixing upload-artifact@v4 with download-artifact@v3 (or vice versa) fails. Keep both on v4.

Security and pinning

  • Artifacts are downloadable by anyone with read access to the repo. Never upload secrets, tokens, or .env files.

Alternatives and related

Frequently asked questions

What changed in upload-artifact v4?
Faster uploads, immutable artifacts, and per-run name uniqueness. It is not compatible with v3, so upload and download must both be v4.
How long are artifacts kept?
Up to the repository or organization retention limit (90 days by default), overridable per upload with retention-days.

References

Running actions/upload-artifact? Run it on Latchkey managed runners - self-healing and caching included. Start free → 30-day trial · No credit card