-
Notifications
You must be signed in to change notification settings - Fork 87
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
Add instructions using actions/cache to README #827
Labels
documentation
Improvements or additions to documentation
good first issue
Good for newcomers
help wanted
Extra attention is needed
Comments
viceice
added
documentation
Improvements or additions to documentation
good first issue
Good for newcomers
help wanted
Extra attention is needed
labels
Feb 13, 2024
@viceice Thanks. In the current version of the README using a third party action there is also an explicit |
feel free to open a PR to update the readme 🤗 |
Hey, we had the same problem and created a working version. renovate.ymlname: Renovate
on:
# This lets you dispatch a renovate job with different cache options if you want to reset or disable the cache manually.
workflow_dispatch:
inputs:
repoCache:
description: 'Reset or disable the cache?'
type: choice
default: enabled
options:
- enabled
- disabled
- reset
schedule:
- cron: '0 0 * * *'
permissions:
actions: write # Required to delete existing cache
contents: read
# Adding these as env variables makes it easy to re-use them in different steps and in bash.
env:
# This is the dir renovate provides -- if we set our own directory via cacheDir, we can run into permissions issues.
# It is also possible to cache a higher level of the directory, but it has minimal benefit. While renovate execution
# time gets faster, it also takes longer to upload the cache as it grows bigger.
cache_dir: /tmp/renovate/cache/renovate/repository
# This can be manually changed to bust the cache if necessary.
cache_key: renovate-cache
jobs:
renovate:
name: Renovate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Restore cache
if: github.event.inputs.repoCache != 'disabled'
id: cache-restore
uses: actions/cache/restore@v4
with:
path: ${{ env.cache_dir }}
key: ${{ env.cache_key }}
- name: Try fix cache permissions
if: ${{ steps.cache-restore.outputs.cache-hit }}
continue-on-error: true
run: |
set -x
# Unfortunately, the permissions expected within renovate's docker container
# are different than the ones given after the cache is restored. We have to
# change ownership to solve this. We also need to have correct permissions in
# the entire /tmp/renovate tree, not just the section with the repo cache.
sudo chown -R 12021:0 /tmp/renovate/
ls -R $cache_dir
- uses: renovatebot/github-action@v41.0.13
with:
configurationFile: self-hosted.json5
token: ${{ secrets.RENOVATE_TOKEN }}
env:
# This enables the cache -- if this is set, it's not necessary to add it to renovate.json.
RENOVATE_REPOSITORY_CACHE: ${{ github.event.inputs.repoCache || 'enabled' }}
- name: Delete previous cache
if: ${{ github.event.inputs.repoCache != 'disabled' && steps.cache-restore.outputs.cache-hit }}
continue-on-error: true
# GitHub CLI is already preinstalled on the runner
run: gh cache delete "${{ env.cache_key }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Save cache
uses: actions/cache/save@v4
if: github.event.inputs.repoCache != 'disabled'
with:
path: ${{ env.cache_dir }}
key: ${{ env.cache_key }} in use at: https://github.com/xdev-software/renovate-selfhosted Should I create a PR? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
documentation
Improvements or additions to documentation
good first issue
Good for newcomers
help wanted
Extra attention is needed
Newer versions of
actions/cache
have resolved previous issues. Prefer this over third party actions.The text was updated successfully, but these errors were encountered: