feat: add caching to self-hosted Renovate workflow#509
Conversation
Add actions/cache restore/save steps to persist /tmp/renovate/cache between runs. The cache key includes the Renovate version so it busts on upgrades, and uses run_id to ensure each run saves fresh data. Also enable repositoryCache in the self-hosted config so Renovate maintains per-repo JSON caches that speed up extraction. https://claude.ai/code/session_0188Gs8tZPdjYXk24NdU1D6m
GitHub Actions caches are immutable, so delete the existing cache via gh CLI before saving the updated one. Removes run_id from the key since we now explicitly delete and re-create each run. https://claude.ai/code/session_0188Gs8tZPdjYXk24NdU1D6m
Skip cache delete/save if Renovate failed to avoid persisting a potentially bad cache state. https://claude.ai/code/session_0188Gs8tZPdjYXk24NdU1D6m
Add id to restore step and condition the delete step on cache-hit, avoiding a needless gh cache delete call on first run or after version bumps. https://claude.ai/code/session_0188Gs8tZPdjYXk24NdU1D6m
Add a regex custom manager so Renovate can detect and update its own version defined as the RENOVATE_VERSION env var in workflow files. https://claude.ai/code/session_0188Gs8tZPdjYXk24NdU1D6m
This manager is only needed in this repo, not in the shared default config. https://claude.ai/code/session_0188Gs8tZPdjYXk24NdU1D6m
There was a problem hiding this comment.
Pull request overview
This PR speeds up the self-hosted Renovate GitHub Actions workflow by persisting Renovate’s on-disk cache between runs and enabling Renovate’s per-repository JSON cache.
Changes:
- Add cache restore/save steps for
/tmp/renovate/cachein the Renovate workflow, and centralize the Renovate CLI version inRENOVATE_VERSION. - Enable
repositoryCachein the self-hosted Renovate config. - Add a Renovate
customManagerto automatically update the pinnedRENOVATE_VERSIONin the workflow.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.github/workflows/renovate.yml |
Restores/saves Renovate cache and introduces RENOVATE_VERSION env var used by the action. |
.github/self-hosted-renovate.js |
Enables Renovate repositoryCache to speed up repeated runs. |
.github/renovate.json5 |
Adds a regex custom manager to keep RENOVATE_VERSION up to date automatically. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Append github.run_id to the cache key so each run saves a unique cache entry, and use restore-keys prefix matching to pick up the latest one. This removes the need to delete the previous cache. https://claude.ai/code/session_0188Gs8tZPdjYXk24NdU1D6m
| uses: actions/cache@v4 | ||
| with: | ||
| path: /tmp/renovate/cache | ||
| key: renovate-cache-${{ env.RENOVATE_VERSION }}-${{ github.run_id }} |
There was a problem hiding this comment.
This works because of https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#cache-hits-and-misses, GitHub caches are immutable
There was a problem hiding this comment.
Pull request overview
Adds caching support to the repo’s self-hosted Renovate setup to speed up repeated runs and centralize Renovate version pinning.
Changes:
- Introduces a workflow-level
RENOVATE_VERSIONenv var and uses it for the Renovate action input. - Adds an
actions/cachestep intended to persist Renovate cache data across runs. - Enables Renovate repository caching and adds a Renovate custom regex manager to keep
RENOVATE_VERSIONup to date automatically.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| .github/workflows/renovate.yml | Adds cache step and moves Renovate version to a workflow env var used by the action. |
| .github/self-hosted-renovate.js | Enables Renovate repository caching. |
| .github/renovate.json5 | Adds a regex-based custom manager to update RENOVATE_VERSION in the workflow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Add caching support to renovate