Skip to content

feat: add 'save' input for restore-only mode#4

Merged
beagleknight merged 1 commit intomainfrom
feat/add-save-input
Mar 27, 2026
Merged

feat: add 'save' input for restore-only mode#4
beagleknight merged 1 commit intomainfrom
feat/add-save-input

Conversation

@beagleknight
Copy link
Copy Markdown

Summary

  • Adds a new save input (default: "true") to action.yml that allows consumers to disable the post-job cache save step
  • When save: "false", the save step returns immediately — making the action restore-only

Motivation

In PR workflows at Factorial, cache is already populated by main-branch and scheduled workflows. The save step on PR jobs adds ~4.5 minutes of overhead (tar creation + S3 upload) to jobs whose actual work takes ~20 seconds. This input lets PR workflows skip the save entirely.

Changes

  • action.yml: New save input with description, default "true"
  • src/save.ts: Early return when save === "false", with info log
  • dist/: Rebuilt with yarn build

Usage

- uses: factorialco/actions-cache@v1.7.0
  with:
    key: my-cache-key-${{ hashFiles('...') }}
    restore-keys: my-cache-key-
    path: ./node_modules
    save: 'false'  # restore-only, skip save
    # ... other inputs

After merge

Please tag as v1.7.0 so we can reference it from Factorial's GAT templates.

Add a new 'save' input (default: 'true') that allows consumers to disable
the post-job cache save. When set to 'false', the save step returns
immediately, making the action restore-only.

This is useful for PR workflows where cache population is handled by
main-branch or scheduled workflows, avoiding ~4.5 min of unnecessary
S3 tar+upload on every PR job.
@beagleknight beagleknight merged commit c92b4e7 into main Mar 27, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants