Skip to content

Renovate

Renovate #281

Workflow file for this run

name: Renovate
on:
schedule:
- cron: '13 */2 * * *'
push:
branches:
- main
paths:
- .github/workflows/renovate.yml
workflow_run:
workflows:
- Test-Linux
types:
- completed
workflow_dispatch:
inputs:
dry-run:
description: 'Dry run'
required: false
default: 'false'
concurrency:
group: renovate
jobs:
prepare:
runs-on: ubuntu-22.04
if: ${{ github.event.workflow_run.conclusion == 'success' }}
outputs:
limit: ${{ steps.rate-limit.outputs.limit }}
remaining: ${{ steps.rate-limit.outputs.remaining }}
renovate: ${{ steps.rate-limit.outputs.renovate }}
env:
GITHUB_TOKEN: ${{ secrets.BOT_RENOVATE }}
steps:
- name: Check rate limit
id: rate-limit
run: |
JSON="$(curl --silent --header "Authorization: token ${GITHUB_TOKEN}" https://api.github.com/rate_limit)"
LIMIT="$(echo ${JSON} | jq --raw-output '.rate.limit')"
REMAINING="$(echo ${JSON} | jq --raw-output '.rate.remaining')"
RESET="$(echo ${JSON} | jq --raw-output '.rate.reset')"
echo "Rate limit: ${REMAINING}/${LIMIT} (reset: $(date --date=@${RESET}))"
echo "limit=${LIMIT}" >>"${GITHUB_OUTPUT}"
echo "remaining=${REMAINING}" >>"${GITHUB_OUTPUT}"
echo "reset=${RESET}" >>"${GITHUB_OUTPUT}"
if [ "${REMAINING}" -lt 1000 ]; then
echo "Rate limit exceeded"
echo "renovate=false" >>"${GITHUB_OUTPUT}"
else
echo "Rate limit sufficient"
echo "renovate=true" >>"${GITHUB_OUTPUT}"
fi
renovate:
runs-on: ubuntu-22.04
needs: prepare
if: ${{ needs.prepare.outputs.renovate == 'true' }}
permissions: write-all
steps:
- name: Restore cache
id: cache-restore
uses: actions/cache/restore@v3
with:
path: renovate/cache
key: renovate-cache
restore-keys: |
renovate-cache-${{ github.sha }}
renovate-cache-
- name: Prepare permissions
run: |
mkdir -p renovate/cache
docker run --rm \
--volume $PWD/renovate:/tmp/renovate \
ubuntu:22.04 \
chown -R 1000:0 /tmp/renovate
- name: Self-hosted Renovate
env:
LOG_LEVEL: debug
RENOVATE_TOKEN: ${{ secrets.BOT_RENOVATE }}
run: |
docker run --interactive --rm \
--env LOG_LEVEL \
--env RENOVATE_TOKEN="${RENOVATE_TOKEN}" \
--volume $PWD/renovate:/tmp/renovate \
renovate/renovate:slim \
--dry-run=${{ inputs.dry-run }} \
"${GITHUB_REPOSITORY}"
- name: Save cache
id: cache-save
uses: actions/cache/save@v3
with:
path: renovate/cache
key: ${{ steps.cache-restore.outputs.cache-primary-key }}-${{ github.sha }}