Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: workflow_dispatch single repo option #71

Merged
merged 5 commits into from
Aug 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 29 additions & 11 deletions .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,54 @@
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
# Cancel any other workflows (PR, cron or manual)
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
group: ${{ github.workflow }}
cancel-in-progress: true

# Variables
env:
config: renovate.json
pr_set: '["bcgov/nr-renovate", "bcgov/quickstart-openshift"]'

jobs:
renovate:
env:
config: renovate.json
Renovate:
permissions:
pull-requests: write
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

# PRs should always use dry run
- name: Set dry run and repo list
# PRs - dry run and a small number of repos
- name: Config for pull requests
if: github.event_name == 'pull_request'
env:
repos: '["bcgov/nr-renovate", "bcgov/quickstart-openshift"]'
run: |
# Dry run and short repo list
cat <<< $(jq '.+= {"dryRun": "full"}' ${{ env.config }}) > ${{ env.config }}
cat <<< $(jq '. | .repositories = ${{ env.repos }}' ${{ env.config }}) > ${{ env.config }}
cat <<< $(jq '. | .repositories = ${{ env.pr_set }}' ${{ 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: |
# Set target repo
cat <<< $(jq '. | .repositories = ["${{ inputs.repo }}"]' ${{ env.config }}) > ${{ env.config }}
cat ${{ env.config }} | jq .repositories

- name: Self-hosted Renovate
# Run Renovate
- name: Run Renovate
uses: renovatebot/[email protected]
with:
configurationFile: ${{ env.config }}
Expand Down