Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 14 additions & 21 deletions .github/actions/cache-checkout/action.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
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: |
.
!.git
!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 }}
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Jan 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Missing fallback for ref parameter will break this action in non-PR contexts (e.g., workflow_dispatch). The cache key correctly uses ${{ github.event.pull_request.head.sha || github.sha }} but the checkout ref lacks the same fallback.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/actions/cache-checkout/action.yml, line 20:

<comment>Missing fallback for `ref` parameter will break this action in non-PR contexts (e.g., `workflow_dispatch`). The cache key correctly uses `${{ github.event.pull_request.head.sha || github.sha }}` but the checkout `ref` lacks the same fallback.</comment>

<file context>
@@ -1,33 +1,26 @@
-          !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
</file context>

Fix confidence (alpha): 10/10

Suggested change
ref: ${{ github.event.pull_request.head.sha }}
ref: ${{ github.event.pull_request.head.sha || github.sha }}
Fix with Cubic

fetch-depth: 2
sparse-checkout-cone-mode: false
sparse-checkout: |
/*
!/example-apps/
!**/*.mp4
2 changes: 0 additions & 2 deletions .github/workflows/api-v1-production-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/api-v2-production-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/api-v2-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/atoms-production-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/check-api-v2-breaking-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/check-types.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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())"
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/companion-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/docs-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/e2e-api-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/e2e-app-store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/e2e-embed-react.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/e2e-embed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/production-build-without-database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/setup-db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading