Skip to content

Scheduling infrastructure for absolutely everyone.

fix: refactor cache-checkout to use actions/cache@v4 with fallback (#26702)

Keith Williamsbf4cdf624565
diff --git a/.github/actions/cache-checkout/action.yml b/.github/actions/cache-checkout/action.yml
index d7bbf1fe515..2f6779e1bb0 100644
--- a/.github/actions/cache-checkout/action.yml
+++ b/.github/actions/cache-checkout/action.yml
@@ -1,17 +1,11 @@
name: Cache Git Checkout
-description: "Save or restore git checkout from cache to speed up CI workflows"
-inputs:
- mode:
- description: "Mode of operation: 'save' to cache the checkout, 'restore' to restore from cache"
- required: true
-
+description: "Cache or restore git checkout to speed up CI workflows"
runs:
using: "composite"
steps:
- - name: Restore git checkout from cache
- if: ${{ inputs.mode == 'restore' }}
- uses: actions/cache/restore@v4
- id: cache-restore
+ - name: Cache git checkout
+ uses: actions/cache@v4
+ id: cache-checkout
with:
path: |
.
@@ -19,15 +13,14 @@ runs:
!node_modules
!**/node_modules
key: git-checkout-${{ github.head_ref || github.ref_name }}-${{ github.event.pull_request.head.sha || github.sha }}
- fail-on-cache-miss: true
-
- - name: Save git checkout to cache
- if: ${{ inputs.mode == 'save' }}
- uses: actions/cache/save@v4
+ - name: Checkout PR code (on cache miss)
+ if: steps.cache-checkout.outputs.cache-hit != 'true'
+ uses: actions/checkout@v4
with:
- path: |
- .
- !.git
- !node_modules
- !**/node_modules
- key: git-checkout-${{ github.head_ref || github.ref_name }}-${{ github.event.pull_request.head.sha || github.sha }}
+ ref: ${{ github.event.pull_request.head.sha }}
+ fetch-depth: 2
+ sparse-checkout-cone-mode: false
+ sparse-checkout: |
+ /*
+ !/example-apps/
+ !**/*.mp4
diff --git a/.github/workflows/api-v1-production-build.yml b/.github/workflows/api-v1-production-build.yml
index 380340d37d1..02e534ce24f 100644
--- a/.github/workflows/api-v1-production-build.yml
+++ b/.github/workflows/api-v1-production-build.yml
@@ -68,8 +68,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- uses: ./.github/actions/cache-db
- name: Cache API v1 production build
diff --git a/.github/workflows/api-v2-production-build.yml b/.github/workflows/api-v2-production-build.yml
index 2d2e9cb4721..fe25f6604d5 100644
--- a/.github/workflows/api-v2-production-build.yml
+++ b/.github/workflows/api-v2-production-build.yml
@@ -38,8 +38,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- name: Generate Prisma schemas
working-directory: apps/api/v2
diff --git a/.github/workflows/api-v2-unit-tests.yml b/.github/workflows/api-v2-unit-tests.yml
index bc33f8b4a85..8eb08509caf 100644
--- a/.github/workflows/api-v2-unit-tests.yml
+++ b/.github/workflows/api-v2-unit-tests.yml
@@ -15,8 +15,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- run: yarn prisma generate
- name: Run API v2 unit tests
diff --git a/.github/workflows/atoms-production-build.yml b/.github/workflows/atoms-production-build.yml
index ef6f9a42105..3552cb5a755 100644
--- a/.github/workflows/atoms-production-build.yml
+++ b/.github/workflows/atoms-production-build.yml
@@ -15,8 +15,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- name: Cache atoms production build
uses: actions/cache@v4
diff --git a/.github/workflows/check-api-v2-breaking-changes.yml b/.github/workflows/check-api-v2-breaking-changes.yml
index 270f0bd08cc..102d837f9c6 100644
--- a/.github/workflows/check-api-v2-breaking-changes.yml
+++ b/.github/workflows/check-api-v2-breaking-changes.yml
@@ -37,8 +37,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- name: Generate Swagger
diff --git a/.github/workflows/check-types.yml b/.github/workflows/check-types.yml
index bd2da476723..dfccf1abaff 100644
--- a/.github/workflows/check-types.yml
+++ b/.github/workflows/check-types.yml
@@ -15,8 +15,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- name: Show info
run: node -e "console.log(require('v8').getHeapStatistics())"
diff --git a/.github/workflows/companion-build.yml b/.github/workflows/companion-build.yml
index 58cd1be35d9..c0f10dc3285 100644
--- a/.github/workflows/companion-build.yml
+++ b/.github/workflows/companion-build.yml
@@ -20,8 +20,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- name: Setup Bun
uses: oven-sh/setup-bun@v1
diff --git a/.github/workflows/docs-build.yml b/.github/workflows/docs-build.yml
index 6e869ff753b..3b573b7a8a5 100644
--- a/.github/workflows/docs-build.yml
+++ b/.github/workflows/docs-build.yml
@@ -15,8 +15,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- name: Cache Docs build
uses: actions/cache@v4
id: cache-docs-build
diff --git a/.github/workflows/e2e-api-v2.yml b/.github/workflows/e2e-api-v2.yml
index 9656c4b4737..5c05003be70 100644
--- a/.github/workflows/e2e-api-v2.yml
+++ b/.github/workflows/e2e-api-v2.yml
@@ -77,8 +77,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- uses: ./.github/actions/cache-db
- name: Build platform packages with Turbo
diff --git a/.github/workflows/e2e-app-store.yml b/.github/workflows/e2e-app-store.yml
index d7bede4762d..a89e2e9124c 100644
--- a/.github/workflows/e2e-app-store.yml
+++ b/.github/workflows/e2e-app-store.yml
@@ -84,8 +84,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- uses: ./.github/actions/yarn-playwright-install
- run: yarn prisma generate
diff --git a/.github/workflows/e2e-embed-react.yml b/.github/workflows/e2e-embed-react.yml
index 5ece5472a75..e6dc9baabe8 100644
--- a/.github/workflows/e2e-embed-react.yml
+++ b/.github/workflows/e2e-embed-react.yml
@@ -76,8 +76,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- uses: ./.github/actions/yarn-playwright-install
- run: yarn prisma generate
diff --git a/.github/workflows/e2e-embed.yml b/.github/workflows/e2e-embed.yml
index eec3307fc36..3ae85bdd5a0 100644
--- a/.github/workflows/e2e-embed.yml
+++ b/.github/workflows/e2e-embed.yml
@@ -84,8 +84,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- uses: ./.github/actions/yarn-playwright-install
- run: yarn prisma generate
diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index 8495fef8231..9d6f702179f 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -85,8 +85,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- uses: ./.github/actions/yarn-playwright-install
- run: yarn prisma generate
diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml
index 1ea84258531..7f8b5b83b66 100644
--- a/.github/workflows/integration-tests.yml
+++ b/.github/workflows/integration-tests.yml
@@ -82,8 +82,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- run: yarn prisma generate
- uses: ./.github/actions/cache-db
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index a141c1579f2..fddbd17f653 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -13,8 +13,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- name: Run Lint
run: yarn lint
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index b99abd9df86..130380fdbda 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -174,11 +174,7 @@ jobs:
db-cache-hit: ${{ steps.cache-db-check.outputs.cache-hit }}
steps:
- uses: actions/checkout@v4
- - uses: ./.github/actions/dangerous-git-checkout
- - name: Cache git checkout
- uses: ./.github/actions/cache-checkout
- with:
- mode: save
+ - uses: ./.github/actions/cache-checkout
- name: Generate DB cache key
id: cache-db-key
uses: ./.github/actions/cache-db-key
diff --git a/.github/workflows/production-build-without-database.yml b/.github/workflows/production-build-without-database.yml
index 512efe6ac71..58f6575521b 100644
--- a/.github/workflows/production-build-without-database.yml
+++ b/.github/workflows/production-build-without-database.yml
@@ -46,8 +46,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- run: yarn prisma generate
- name: Generate cache key
diff --git a/.github/workflows/setup-db.yml b/.github/workflows/setup-db.yml
index 66e4ea042fd..b0667355b60 100644
--- a/.github/workflows/setup-db.yml
+++ b/.github/workflows/setup-db.yml
@@ -50,8 +50,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
if: inputs.DB_CACHE_HIT != 'true'
- run: yarn prisma generate
diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml
index 532ddb77a81..b1df3dc09ed 100644
--- a/.github/workflows/unit-tests.yml
+++ b/.github/workflows/unit-tests.yml
@@ -15,8 +15,6 @@ jobs:
with:
sparse-checkout: .github
- uses: ./.github/actions/cache-checkout
- with:
- mode: restore
- uses: ./.github/actions/yarn-install
- run: yarn prisma generate
- run: yarn test -- --no-isolate