feat: move extendable Renovate config to default.json #539
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Renovate | |
# Run on pull requests, cronjob or manually (dispatch) | |
on: | |
pull_request: | |
schedule: # 2 AM PST = 10 AM UDT | |
- cron: "0 10 * * *" | |
- cron: "0 12 * * *" | |
- cron: "0 14 * * *" | |
workflow_dispatch: | |
inputs: | |
repos: # Optional input | |
description: "List of repos (org/repo)" | |
type: string | |
required: false | |
log_level: # Optional input | |
description: "Log level" | |
default: "INFO" | |
type: choice | |
required: true | |
options: ["INFO", "WARNING", "DEBUG"] | |
# Cancel any other workflows (PR, cron or manual) | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
# Variables | |
env: | |
config: renovate.json | |
pr_set: '["bcgov/nr-renovate", "bcgov/quickstart-openshift"]' | |
jobs: | |
Renovate: | |
permissions: | |
pull-requests: write | |
runs-on: ubuntu-22.04 | |
steps: | |
# workflow_dispatch - optional inputs | |
- uses: actions/checkout@v4 | |
- name: Config for manual workflows (optional) | |
# if: inputs.repos | |
run: | | |
# Process and reformat inputs.repos | |
IFS=', ' read -a INPUT <<< "${{ inputs.repos }}" | |
for r in "${INPUT[@]}"; do | |
REPOS+="\"$r\"," | |
done | |
REPOS=${REPOS%,*} | |
# Set target repos | |
cat <<< $(jq '. | .repositories = ['${REPOS}']' ${{ env.config }}) > ${{ env.config }} | |
cat ${{ env.config }} | jq .repositories | |
# PRs - dry run and a small number of repos | |
- name: Config for pull requests | |
if: github.event_name == 'pull_request' | |
run: | | |
# Dry run and short repo list | |
cat <<< $(jq '.+= {"dryRun": "full"}' ${{ env.config }}) > ${{ env.config }} | |
cat <<< $(jq '. | .repositories = ${{ env.pr_set }}' ${{ env.config }}) > ${{ env.config }} | |
cat ${{ env.config }} | jq .repositories | |
# Run Renovate | |
- name: Run Renovate | |
uses: renovatebot/github-action@v39.1.0 | |
env: | |
LOG_LEVEL: ${{ inputs.log_level || 'INFO' }} | |
with: | |
configurationFile: ${{ env.config }} | |
token: ${{ secrets.RENOVATE_TOKEN }} |