feat(renovate): GitHub cache for Renovate repo cache

This commit is contained in:
JJGadgets
2024-12-06 13:37:07 +08:00
parent b5b7472070
commit 2ec10229d0

View File

@@ -15,6 +15,11 @@ on:
description: Log-Level
default: debug
required: false
cache:
description: Use Renovate cache from GitHub repo's cache?
type: choice
default: "enabled"
options: ["enabled", "disabled", "reset"]
paths:
description: Paths to run Renovate on. Comma separated without spaces for multiple.
required: false
@@ -46,6 +51,8 @@ env:
RENOVATE_AUTODISCOVER_FILTER: "${{ github.repository }}" # this is to prevent forks from running Renovate against upstream repo
RENOVATE_USERNAME: "${{ secrets.BOT_USERNAME }}[bot]"
RENOVATE_GIT_AUTHOR: "${{ secrets.BOT_USERNAME }} <${{ secrets.BOT_API_ID }}+${{ secrets.BOT_USERNAME }}[bot]@users.noreply.github.com>" # get $BOT_API_ID from `curl -s 'https://api.github.com/users/$(BOT_USERNAME)%5Bbot%5D' | yq .id`
RENOVATE_REPOSITORY_CACHE: "enabled"
GH_CACHE_DIR: "/tmp/renovate/cache/renovate/repository"
jobs:
renovate:
@@ -69,9 +76,21 @@ jobs:
run: |
echo "RENOVATE_DRY_RUN=${{ github.event.inputs.dryRun || env.RENOVATE_DRY_RUN }}" >> "${GITHUB_ENV}"
echo "LOG_LEVEL=${{ github.event.inputs.logLevel || env.LOG_LEVEL }}" >> "${GITHUB_ENV}"
echo "RENOVATE_REPOSITORY_CACHE=${{ github.event.inputs.cache || env.RENOVATE_REPOSITORY_CACHE }}" >> "${GITHUB_ENV}"
if [[ ! -z "${{ github.event.inputs.paths }}" ]]; then echo "RENOVATE_INCLUDE_PATHS=${{ github.event.inputs.paths }}" >> "${GITHUB_ENV}"; fi
if [[ ! -z "${{ github.event.inputs.managers }}" ]]; then echo "RENOVATE_ENABLED_MANAGERS=${{ github.event.inputs.managers }}" >> "${GITHUB_ENV}"; fi
- name: Renovate Cache
id: renovate-cache
uses: actions/cache@v4
if: github.event.inputs.cache != 'disabled'
continue-on-error: true
with:
path: "${{ env.GH_CACHE_DIR }}"
key: "renovate-cache-${{ runner.os }}-${{ github.run_id }}"
restore-keys: |
renovate-cache-${{ runner.os }}
- name: Renovate
uses: renovatebot/github-action@936628dfbff213ab2eb95033c5e123cfcaf09ebb # v41.0.5
with: