DEV: Update the ESLint caching mechanism #5371
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
The
restore-keysis the fallback mechanism. When running on a branch likefeature/RI-123/something:eslint-Linux-feature/RI-123/somethingcacheeslint-Linux-(which includeseslint-Linux-main)So what happens if we change
.eslintrc.js? - That makes ESLint ignore the cache, lint all the files, and create a new cache.The problem comes because the GitHub action doesn't update the cache if it has the same name (the action step returns:
Post job cleanup. Cache hit occurred on the primary key eslint-Linux-feature-.... not saving cache.There's a hack to do it manually - Go to Actions -> Caches and delete the old one, then after the first run, the cache will be OK. But this is manual work, so this PR solves this problem.
Another thing
For the sake of automation, now every merge in
mainwould trigger the linter to prepare the cache. If that PR didn't update anything ESLint-related, it will reuse the cache, and it will be a very quick one.Added
workflow_dispatchas well, in case we want to run it manually.Note
Improves ESLint workflow reliability and automation.
pushonmainandworkflow_dispatchtriggers to runlintautomatically and on-demandkey/restore-keysto includehashFiles('.eslintrc.js')andgithub.ref_name, ensuring cache invalidates on ESLint config changes while retaining branch-specific reuseWritten by Cursor Bugbot for commit d179096. This will update automatically on new commits. Configure here.