How to properly cache Rector cache in Github Actions? #8357
Unanswered
CanVuralStudocu
asked this question in
Q&A
Replies: 1 comment 5 replies
-
The only problem with that cache key is that it doesn’t get updated so the cache makes less and less sense over time until it’s invalidated thanks to composer.lock being updated. You can use a trick in GitHub Actions that:
the trick is to have a unique key each time, by appending run ID to the end, and then have the common prefix in Like mentioned here (also applies to PHPStan’s result cache): https://staabm.github.io/2023/10/21/phpstan-result-cache-gotchas.html |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
Documentation recommends this cache key
${{ runner.os }}-rector-${{ hashFiles('**/composer.lock') }}
to be used in Github Actions.But this cache key only depends on the changes of composer.lock files. Does not change with the actual code file changes. For example if a new file is added or removed from the codebase, Rector cache would not be aware of that.
Does anyone use a different cache key? Like a key created from the all files in a directory or something?
Beta Was this translation helpful? Give feedback.
All reactions