Skip to content
Latchkey

How to Set Artifact Compression Level in GitHub Actions

compression-level (0 to 9) controls the zip compression, letting you trade CPU time for a smaller artifact.

Set compression-level: on actions/upload-artifact@v4. 0 stores with no compression (fast), 6 is the default, and 9 is smallest but slowest.

Steps

  • Add compression-level: to the upload step.
  • Use 0 for already-compressed files (images, zips, videos).
  • Use 9 for large text output where size matters more than speed.

Workflow

.github/workflows/ci.yml
steps:
  - uses: actions/upload-artifact@v4
    with:
      name: logs
      path: logs/
      compression-level: 9

Gotchas

  • Recompressing already-compressed data wastes CPU; use level 0 there.
  • Valid values are 0 through 9; anything else fails validation.

Related guides

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