|
|
|
|
|
|
|
|
|
|
|
|
|
|
name: Renovate |
|
|
on: |
|
|
workflow_dispatch: |
|
|
inputs: |
|
|
logLevel: |
|
|
description: 'Log level' |
|
|
type: choice |
|
|
default: debug |
|
|
options: |
|
|
- debug |
|
|
- trace |
|
|
dryRun: |
|
|
description: 'Dry run?' |
|
|
type: choice |
|
|
default: 'no' |
|
|
options: |
|
|
- 'no' |
|
|
- full |
|
|
- lookup |
|
|
- extract |
|
|
repoCache: |
|
|
description: 'Reset or disable the cache?' |
|
|
type: choice |
|
|
default: enabled |
|
|
options: |
|
|
- enabled |
|
|
- disabled |
|
|
- reset |
|
|
schedule: |
|
|
|
|
|
- cron: '0,30 * * * *' |
|
|
pull_request: |
|
|
paths: |
|
|
- '.github/workflows/renovate.yml' |
|
|
- 'renovate.json5' |
|
|
- 'renovate.json' |
|
|
|
|
|
concurrency: |
|
|
group: renovate-${{ github.ref }} |
|
|
|
|
|
env: |
|
|
|
|
|
RENOVATE_VERSION: 36.31.0 |
|
|
cache_archive: renovate_cache.tar.gz |
|
|
|
|
|
cache_dir: /tmp/renovate/cache/renovate/repository |
|
|
cache_key: gandalfs-renovate-cache |
|
|
|
|
|
jobs: |
|
|
renovate: |
|
|
name: Renovate |
|
|
runs-on: ubuntu-latest |
|
|
steps: |
|
|
- uses: actions/checkout@v3 |
|
|
- uses: dawidd6/action-download-artifact@v6 |
|
|
if: github.event.inputs.repoCache != 'disabled' |
|
|
continue-on-error: true |
|
|
with: |
|
|
name: ${{ env.cache_key }} |
|
|
path: cache-download |
|
|
|
|
|
- name: Extract renovate cache |
|
|
run: | |
|
|
set -x |
|
|
# Skip if no cache is set, such as the first time it runs. |
|
|
if [ ! -d cache-download ] ; then |
|
|
echo "No cache found." |
|
|
exit 0 |
|
|
fi |
|
|
|
|
|
|
|
|
mv "cache-download/$cache_archive" $cache_archive |
|
|
|
|
|
|
|
|
mkdir -p $cache_dir |
|
|
tar -xzf $cache_archive -C $cache_dir |
|
|
rm $cache_archive |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sudo chown -R runneradmin:root /tmp/renovate/ |
|
|
ls -R $cache_dir |
|
|
|
|
|
- uses: renovatebot/github-action@v39.0.1 |
|
|
with: |
|
|
configurationFile: renovate.json5 |
|
|
token: ${{ secrets.RENOVATE_TOKEN }} |
|
|
renovate-version: ${{ env.RENOVATE_VERSION }} |
|
|
env: |
|
|
LOG_LEVEL: ${{ github.event.inputs.logLevel || 'debug' }} |
|
|
RENOVATE_DRY_RUN: ${{ github.event.inputs.dryRun == 'no' && 'null' || github.event.inputs.dryRun || 'null' }} |
|
|
RENOVATE_REPOSITORY_CACHE: ${{ github.event.inputs.repoCache || 'enabled' }} |
|
|
|
|
|
|
|
|
- name: Compress renovate cache |
|
|
run: | |
|
|
ls $cache_dir |
|
|
# The -C is important -- otherwise we end up extracting the files with |
|
|
# their full path, ultimately leading to a nested directory situation. |
|
|
# To solve *that*, we'd have to extract to root (/), which isn't safe. |
|
|
tar -czvf $cache_archive -C $cache_dir . |
|
|
|
|
|
- uses: actions/upload-artifact@v4 |
|
|
if: github.event.inputs.repoCache != 'disabled' |
|
|
with: |
|
|
name: ${{ env.cache_key }} |
|
|
path: ${{ env.cache_archive }} |
|
|
|
|
|
retention-days: 1 |
|
|
|
|
|
validate-renovate-config: |
|
|
name: Validate Renovate Configuration |
|
|
runs-on: ubuntu-latest |
|
|
steps: |
|
|
- uses: actions/checkout@v3 |
|
|
- name: Run Config Validator |
|
|
run: yarn dlx -p renovate@$RENOVATE_VERSION renovate-config-validator |
|
|
|