feat: workflow_dispatch single repo option #302
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: | |
- cron: "0 11 * * *" # 3 AM PST = 11 AM UDT | |
workflow_dispatch: | |
inputs: | |
repo: # Optional input | |
description: org/repo override (optional) | |
type: string | |
required: false | |
# PR open and close use the same group, allowing only one at a time | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
# Variables | |
env: | |
config: renovate.json | |
pr_repos: '["bcgov/nr-renovate", "bcgov/quickstart-openshift"]' | |
jobs: | |
renovate: | |
permissions: | |
pull-requests: write | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
# PRs - dry run and a small number of repos | |
- name: Config for pull requests | |
if: github.event_name == 'pull_request' | |
run: | | |
cat <<< $(jq '.+= {"dryRun": "full"}' ${{ env.config }}) > ${{ env.config }} | |
cat <<< $(jq '. | .repositories = ${{ env.pr_repos }}' ${{ env.config }}) > ${{ env.config }} | |
cat ${{ env.config }} | jq .repositories | |
# workflow_dispatch - optionally just one repo | |
- name: Config for manual workflows (optional) | |
if: inputs.repo | |
run: | | |
cat <<< $(jq '. | .repositories = ["${{ inputs.repo }}"]' ${{ env.config }}) > ${{ env.config }} | |
cat ${{ env.config }} | jq .repositories | |
# Run Renovate | |
- name: Run Renovate | |
uses: renovatebot/[email protected] | |
with: | |
configurationFile: ${{ env.config }} | |
token: ${{ secrets.RENOVATE_TOKEN }} |