-
Notifications
You must be signed in to change notification settings - Fork 183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: reduce cache misses by forking main cache for each pull request #691
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
.github/actions/setup/action.yml
Outdated
restore-keys: | | ||
${{ runner.os }}-turbo-${{ github.ref_name }}- | ||
${{ runner.os }}-turbo-main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of branch of a branch, maybe removing ${{ runner.os }}-turbo-main-
and just matching to the most recent ${{ runner.os }}-turbo-
might be better, as the CI/CD is becoming very fast and likely the devs approving these ci/cd processes will be focusing on individual problems at a time.
6cef8cd
to
7d60637
Compare
I noticed that turbo supports env vars: https://turbo.build/repo/docs/core-concepts/caching#altering-caching-based-on-environment-variables So another approach could be adding |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
In the case where multiple developers are pushing branches simultaneously and running the
ci/cd
, the present action just checks package differences against the most recently built cache. With this change, pull_requests will have their own branch of cache.By including GITHUB_REF in our
key
andrestore-key
, we can essentially create a forked cache from the latest main cache.Information:
The cache action searches the restore-keys in sequential order. When a key doesn't match directly, the action searches for keys prefixed with the restore key. If there are multiple partial matches for a restore key, the action returns the most recently created cache.