|
| 1 | +--- |
| 2 | +name: Renovate |
| 3 | +on: |
| 4 | + # checkov:skip=CKV_GHA_7: "Workflow dispatch inputs are required for manual debugging and configuration" |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + dryRun: |
| 8 | + description: Dry Run |
| 9 | + default: "false" |
| 10 | + required: false |
| 11 | + logLevel: |
| 12 | + description: Log Level |
| 13 | + default: "debug" |
| 14 | + required: false |
| 15 | + version: |
| 16 | + description: Renovate version |
| 17 | + default: latest |
| 18 | + required: false |
| 19 | + schedule: |
| 20 | + # Run every evening at 20:00 UTC (8:00 PM UTC) |
| 21 | + - cron: "0 20 * * *" |
| 22 | + push: |
| 23 | + branches: ["main"] |
| 24 | + paths: |
| 25 | + - .github/renovate.json5 |
| 26 | + - .github/renovate/**.json5 |
| 27 | + |
| 28 | +permissions: |
| 29 | + contents: read |
| 30 | + pull-requests: write |
| 31 | + issues: write |
| 32 | + |
| 33 | +concurrency: |
| 34 | + group: ${{ github.workflow }}-${{ github.run_number || github.ref }} |
| 35 | + cancel-in-progress: true |
| 36 | + |
| 37 | +# Retrieve BOT_USER_ID via `curl -s "https://api.github.com/users/${BOT_USERNAME}%5Bbot%5D" | jq .id` |
| 38 | +env: |
| 39 | + WORKFLOW_DRY_RUN: false |
| 40 | + WORKFLOW_LOG_LEVEL: debug |
| 41 | + WORKFLOW_VERSION: latest # 37.59.8 |
| 42 | + RENOVATE_PLATFORM: github |
| 43 | + RENOVATE_PLATFORM_COMMIT: true |
| 44 | + RENOVATE_ONBOARDING_CONFIG_FILE_NAME: .github/renovate.json5 |
| 45 | + RENOVATE_AUTODISCOVER: true |
| 46 | + RENOVATE_AUTODISCOVER_FILTER: "${{ github.repository }}" |
| 47 | + RENOVATE_GIT_AUTHOR: "${{ secrets.BOT_USERNAME }} <${{ secrets.BOT_USER_ID }}+${{ secrets.BOT_USERNAME }}[bot]@users.noreply.github.com>" |
| 48 | + |
| 49 | +jobs: |
| 50 | + renovate: |
| 51 | + name: Renovate |
| 52 | + runs-on: ubuntu-latest |
| 53 | + steps: |
| 54 | + - name: Generate Token |
| 55 | + uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2 |
| 56 | + id: app-token |
| 57 | + with: |
| 58 | + app-id: "${{ secrets.BOT_APP_ID }}" |
| 59 | + private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}" |
| 60 | + |
| 61 | + - name: Checkout |
| 62 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 63 | + with: |
| 64 | + token: "${{ steps.app-token.outputs.token }}" |
| 65 | + |
| 66 | + - name: Override default config from dispatch variables |
| 67 | + run: | |
| 68 | + echo "RENOVATE_DRY_RUN=${{ github.event.inputs.dryRun || env.WORKFLOW_DRY_RUN }}" >> "${GITHUB_ENV}" |
| 69 | + echo "LOG_LEVEL=${{ github.event.inputs.logLevel || env.WORKFLOW_LOG_LEVEL }}" >> "${GITHUB_ENV}" |
| 70 | +
|
| 71 | + - name: Delete old dashboard |
| 72 | + run: | |
| 73 | + ISSUE_NUMBER=$(gh issue list -S 'Renovate Dashboard 🤖' --json number -q '.[0].number') |
| 74 | + if [ "$ISSUE_NUMBER" != "null" ] && [ -n "$ISSUE_NUMBER" ]; then |
| 75 | + gh issue close "$ISSUE_NUMBER" |
| 76 | + else |
| 77 | + echo "No issue found to close." |
| 78 | + fi |
| 79 | + env: |
| 80 | + GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}" |
| 81 | + |
| 82 | + - name: Renovate |
| 83 | + uses: renovatebot/github-action@19e3d87179488d6a0cd9da744d37123ea4b338e5 # v41.0.20 |
| 84 | + with: |
| 85 | + configurationFile: "${{ env.RENOVATE_ONBOARDING_CONFIG_FILE_NAME }}" |
| 86 | + token: "${{ steps.app-token.outputs.token }}" |
| 87 | + renovate-version: "${{ github.event.inputs.version || env.WORKFLOW_VERSION }}" |
0 commit comments