From 1a7aa870f5b0407071699a5d52933d8b34b2987e Mon Sep 17 00:00:00 2001 From: merencia Date: Mon, 22 Jun 2026 11:56:06 -0300 Subject: [PATCH] fix(ci): scope build cache to run attempt, not commit SHA The setup action cached build outputs (**/dist, node_modules) under a key scoped to github.sha. The downstream lint/test/integration jobs do not build; they rely on restoring that cache. Because actions/cache never overwrites an existing key, a corrupted or partial upload (e.g. a job cancelled mid-upload by cancel-in-progress during a merge train) stuck permanently: every re-run of that SHA restored the broken cache, so build passed while lint/test/integration failed with missing dist (unresolved types, 'Cannot find module .../dist'). Scope the key to github.run_id + github.run_attempt instead. Jobs within one run still share build outputs, but each run/re-run gets a fresh key, so a bad cache can never block a re-run. No cross-commit reuse is lost (the SHA key already prevented that). --- .github/actions/setup/action.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 43072651..650445b0 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -24,7 +24,13 @@ runs: node_modules **/node_modules **/dist - key: ${{ runner.os }}-build-${{ hashFiles('**/yarn.lock') }}-${{ github.sha }} + # Scope the cache to a single workflow run attempt. The build job and the + # downstream jobs (lint/test/integration) share build outputs within one run, + # but a re-run gets a fresh key. Previously the key was scoped to the commit + # SHA only, so a corrupted/partial cache upload (e.g. a job cancelled mid-upload + # by cancel-in-progress) would stick: actions/cache never overwrites an existing + # key, so every re-run of that SHA restored the broken cache and failed. + key: ${{ runner.os }}-build-${{ hashFiles('**/yarn.lock') }}-${{ github.run_id }}-${{ github.run_attempt }} - name: Enable Corepack shell: bash