Skip to content

perf(NOJIRA-123): save the Node cache from the Build job only - #290

Open
adriancarayol wants to merge 1 commit into
perf/setup-node-cache-restore-onlyfrom
ci/setup-node-save-cache-never
Open

adriancarayol wants to merge 1 commit into
perf/setup-node-cache-restore-onlyfrom
ci/setup-node-save-cache-never

Conversation

@adriancarayol

Copy link
Copy Markdown

Overview

Jira ticket: NOJIRA-123

This is the follow-up to #287, and it's stacked on it: the base is #287's branch, so the diff only shows this change. Merge #287 first. GitHub then retargets this PR to main.

In frontend-pr-workflow.yml and frontend-deploy-workflow.yml, only the Build job saves the Node dependency cache. Every other job that runs setup-node-with-cache passes save-cache: 'never'.

Problem and evidence

#287's auto policy stops PR jobs from saving after a restore-key fallback. It still saves from every job on the default branch, though, and in frontend-pr-workflow the Unit Tests job runs in parallel with Build (it has no needs). On a push to main that changes dependencies, both jobs miss the key, both compress the archive, and one of them fails with Unable to reserve cache … another job may be creating this cache.

Measured in Typeform/automations (job logs, Nov 9–16):

Changes

  • New input save-node-cache (auto default, default-branch, never, always) in both reusable workflows. It's passed to the Build job's setup-node-with-cache as save-cache.

  • save-cache: 'never' in the other jobs that call the action:

    • frontend-pr-workflow: unit-tests (runs alongside Build), integration-tests and deploy-preview (both needs: build)
    • frontend-deploy-workflow: unit-tests, integration-tests and deploy (all needs: build)

    The jobs that need Build start after its save, so they usually get an exact hit and wouldn't save anyway. Setting never there makes "Build saves, everything else restores" an explicit rule, rather than one that depends on timing.

  • README row for save-node-cache in reusable-workflows/frontend-pr-workflow/README.md.

Out of scope:

  • The run-cypress-* and run-playwright-visual actions call setup-node-with-cache internally. They all run after Build.
  • The legacy reusable-workflows/frontend-pr-workflow/workflow.yml: every job after Build there has needs: build.
  • Repo-owned workflows (for example automations' logicator2000-pr.yml) still need save-cache: never in their own parallel jobs. I'll do those per repo after v1 moves.

Risks

  • Before v1 moves, these workflows still call the action at @v1, which has no save-cache input. GitHub logs a warning for an unexpected input and ignores it, so behaviour stays the same until release moves v1 to include perf(NOJIRA-123): keep setup-node-with-cache saves off the PR critical path #287.
  • A repo where Build is skipped or fails while other jobs pass won't save a cache for that commit. The next run's Build saves it.
  • save-node-cache: never turns off saving for the whole workflow. That's only useful together with a separate cache-warming job.

Testing

  • actionlint 1.7.12 on both workflows gives the same findings as the base branch (32 lines; only the line numbers moved). None are new.
  • Not run end to end. The workflows pin the action at @v1, so a caller pinned to this branch would still run the old action until v1 moves. The value passed here is the one tested end to end in perf(NOJIRA-123): keep setup-node-with-cache saves off the PR critical path #287: never skips the save, the same path as auto on a PR fallback.

Docs

  • Yes! ✋ I have updated the documentation.

For contributions to the Typeform/.github repo

  • This PR only changes an existing workflow.
  • This PR adds a new workflow that is needed in a public Typeform repository.

🤖 Generated with Claude Code

Parallel and downstream jobs in frontend-pr-workflow and
frontend-deploy-workflow now pass save-cache: never to
setup-node-with-cache, and the Build job takes its policy from a new
save-node-cache input (default auto). Stops jobs racing to save the
same key after a miss, including on pushes to main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@adriancarayol
adriancarayol requested a review from a team as a code owner November 16, 2026 13:29
@pr-auditor

pr-auditor Bot commented Nov 16, 2026

Copy link
Copy Markdown

✅ Security Analysis Results

No security issues found. 3 files reviewed.


@pr-auditor rescan to re-run · Powered by Claude Sonnet 5.5 · Docs · #security-engineering-team

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.

1 participant