Skip to content

chore: use lookup-only cache check to skip deps job downloads - #26314

Merged
keithwillcode merged 11 commits into
mainfrom
devin/1767104829-skip-yarn-install-on-cache-hit
Dec 30, 2025
Merged

keithwillcode merged 11 commits into
mainfrom
devin/1767104829-skip-yarn-install-on-cache-hit

Conversation

@keithwillcode

@keithwillcode keithwillcode commented Dec 30, 2025 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Optimizes the "Install Dependencies / Yarn install & cache" step in pr.yml by using lookup-only cache checks to avoid downloading ~1.2GB of cache data when caches already exist.

The deps job is primarily for populating the cache when nothing is cached. Previously, even when skipping installs, the cache restore steps would still download all cached data. Now, when skip-install-if-cache-hit: "true" is set:

  1. First, run actions/cache/restore@v4 with lookup-only: true to check if caches exist without downloading
  2. If all caches hit, skip the entire restore + install flow (no downloads at all)
  3. If any cache misses, fall back to normal restore + install + save behavior

This adds a skip-install-if-cache-hit parameter to both the yarn-install and yarn-playwright-install actions (defaulting to "false" for backward compatibility) and enables it only for the deps job in yarn-install.yml.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - CI workflow change only.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works. N/A - CI workflow changes are tested by running CI itself.

How should this be tested?

  1. Create a PR with this change
  2. On first run (cache miss), the deps job should:
    • Run lookup-only checks (which will miss)
    • Fall back to full cache restore + yarn install + playwright install
  3. On subsequent runs (cache hit), the deps job should:
    • Run lookup-only checks (which will hit)
    • Skip ALL cache restore steps and installs (no 1.2GB download)
  4. Verify other jobs (type-check, lint, unit-test, etc.) still work correctly as they don't pass the skip flag

Human Review Checklist

  • Verify lookup-only steps only run when skip-install-if-cache-hit == 'true'
  • Verify restore/install steps are skipped when skip-install-if-cache-hit == 'true' AND cache-hit == 'true'
  • Verify the conditional uses yarn-nm-cache-check (the lookup-only step) not yarn-nm-cache (the restore step)
  • Confirm default value "false" maintains backward compatibility for other workflows
  • Verify same pattern is applied consistently to playwright-install action

The Install Dependencies / Yarn install & cache step in pr.yml is primarily
for populating the cache when nothing is cached. When cache keys are found,
we can skip the actual yarn install and let the workflow carry on quickly.

This adds a skip-install-if-cache-hit parameter to the yarn-install action
that allows skipping the install when node_modules cache is hit. This is
enabled for the deps job in yarn-install.yml but not for other jobs that
actually need node_modules for their work.

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@keithwillcode keithwillcode changed the title fix(ci): skip yarn install in deps job when cache is hit chore: skip yarn install in deps job when cache is hit Dec 30, 2025
Extends the skip-install-if-cache-hit parameter to the yarn-playwright-install
action as well, so both yarn install and playwright install are skipped in the
deps job when their respective caches are hit.

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
@vercel

vercel Bot commented Dec 30, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Review Updated (UTC)
cal Ignored Ignored Dec 30, 2025 3:03pm
cal-companion Ignored Ignored Preview Dec 30, 2025 3:03pm
cal-eu Ignored Ignored Dec 30, 2025 3:03pm

@devin-ai-integration devin-ai-integration Bot changed the title chore: skip yarn install in deps job when cache is hit chore: skip yarn and playwright install in deps job when cache is hit Dec 30, 2025
When skip-install-if-cache-hit is true, use actions/cache/restore@v4 with
lookup-only: true to check if caches exist without downloading them. This
avoids downloading ~1.2GB of cache data when we just want to verify caches
exist in the deps job.

The flow is now:
1. If skip-install-if-cache-hit is true, run lookup-only checks for all caches
2. If all caches hit, skip the entire restore + install flow (no downloads)
3. If any cache misses, fall back to normal restore + install + save behavior

This optimization only applies when skip-install-if-cache-hit is set to true,
so other jobs that need node_modules continue to work normally.

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>
Comment thread .github/actions/yarn-install/action.yml Resolved
Comment thread .github/actions/yarn-install/action.yml Resolved
@pull-request-size pull-request-size Bot added size/M and removed size/S labels Dec 30, 2025
@devin-ai-integration devin-ai-integration Bot changed the title chore: skip yarn and playwright install in deps job when cache is hit fix(ci): use lookup-only cache check to skip deps job downloads Dec 30, 2025
@keithwillcode keithwillcode self-assigned this Dec 30, 2025
@keithwillcode
keithwillcode marked this pull request as ready for review December 30, 2025 14:51
@graphite-app
graphite-app Bot requested a review from a team December 30, 2025 14:51
@graphite-app graphite-app Bot added the core area: core, team members only label Dec 30, 2025
@keithwillcode keithwillcode changed the title fix(ci): use lookup-only cache check to skip deps job downloads chore: use lookup-only cache check to skip deps job downloads Dec 30, 2025
Comment thread .github/actions/yarn-install/action.yml Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 issues found across 3 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name=".github/actions/yarn-install/action.yml">

<violation number="1" location=".github/actions/yarn-install/action.yml:71">
P2: The lookup-only checks for `yarn-download-cache-check` and `yarn-install-state-cache-check` are performed but their results are never used. Only `yarn-nm-cache-check.outputs.cache-hit` is checked in conditions. Per the PR description (&#39;If all caches hit, skip... If any cache misses, fall back...&#39;), the condition should check all three caches, or the unused lookup-only steps should be removed to avoid wasted CI time.</violation>
</file>

<file name=".github/actions/yarn-playwright-install/action.yml">

<violation number="1" location=".github/actions/yarn-playwright-install/action.yml:31">
P1: The condition breaks backward compatibility. When `skip-install-if-cache-hit` is `&#39;false&#39;` (default), the first operand `inputs.skip-install-if-cache-hit != &#39;true&#39;` is always true, so the install step runs unconditionally—ignoring the cache hit status from `playwright-cache`.

The condition should check `playwright-cache.outputs.cache-hit` in the default case:</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread .github/actions/yarn-install/action.yml Resolved
Comment thread .github/actions/yarn-install/action.yml Resolved
@keithwillcode
keithwillcode marked this pull request as draft December 30, 2025 15:00
1. yarn-install: Add 'all-caches-check' step to compute whether all three
   caches hit (not just node_modules). This ensures we only bail out when
   everything is cached, matching the PR description.

2. yarn-playwright-install: Fix backward compatibility for install step.
   In default mode, check playwright-cache.outputs.cache-hit (the restore step).
   In skip mode, check playwright-cache-check.outputs.cache-hit (lookup-only).

Co-Authored-By: keith@cal.com <keithwillcode@gmail.com>

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 3 files

@keithwillcode

Copy link
Copy Markdown
Contributor Author

This branch was successfully deployed

1 active deployment
Preview – dev — 0b0e67fd Deployed Dec 30, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants