From 0634253b7faeaee77e4dd5b91183e1db7e2df730 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Fri, 11 Aug 2023 11:46:50 -0700 Subject: [PATCH 1/5] workflow_dispatch single repo option --- .github/workflows/renovate.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index f4971d1..27a2cf2 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -4,6 +4,11 @@ on: schedule: - cron: "0 11 * * *" # 3 AM PST = 11 AM UDT workflow_dispatch: + inputs: + repository: + description: optional single org/repo to run against + type: string + required: false # PR open and close use the same group, allowing only one at a time concurrency: @@ -20,7 +25,7 @@ jobs: steps: - uses: actions/checkout@v3 - # PRs should always use dry run + # PRs - dry run and a small number of repos - name: Set dry run and repo list if: github.event_name == 'pull_request' env: @@ -30,6 +35,14 @@ jobs: cat <<< $(jq '. | .repositories = ${{ env.repos }}' ${{ env.config }}) > ${{ env.config }} cat ${{ env.config }} | jq .repositories + # workflow_dispatch - optionally just one repo + - name: Set dry run and repo list + if: inputs.repository + run: | + cat <<< $(jq '. | .repositories = ["${{ inputs.repository }}"]' ${{ env.config }}) > ${{ env.config }} + cat ${{ env.config }} | jq .repositories + + # Run Renovate - name: Self-hosted Renovate uses: renovatebot/github-action@v39.0.1 with: From 595ef419fa8b34757098243b073eac02bd537dd0 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Fri, 11 Aug 2023 11:55:30 -0700 Subject: [PATCH 2/5] Wording --- .github/workflows/renovate.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 27a2cf2..2cef2da 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -5,8 +5,8 @@ on: - cron: "0 11 * * *" # 3 AM PST = 11 AM UDT workflow_dispatch: inputs: - repository: - description: optional single org/repo to run against + repo: + description: org/repo override (optional) type: string required: false @@ -26,7 +26,7 @@ jobs: - uses: actions/checkout@v3 # PRs - dry run and a small number of repos - - name: Set dry run and repo list + - name: Config for pull requests if: github.event_name == 'pull_request' env: repos: '["bcgov/nr-renovate", "bcgov/quickstart-openshift"]' @@ -36,14 +36,14 @@ jobs: cat ${{ env.config }} | jq .repositories # workflow_dispatch - optionally just one repo - - name: Set dry run and repo list - if: inputs.repository + - name: Config for manual workflows (optional) + if: inputs.repo run: | - cat <<< $(jq '. | .repositories = ["${{ inputs.repository }}"]' ${{ env.config }}) > ${{ env.config }} + cat <<< $(jq '. | .repositories = ["${{ inputs.repo }}"]' ${{ env.config }}) > ${{ env.config }} cat ${{ env.config }} | jq .repositories # Run Renovate - - name: Self-hosted Renovate + - name: Run Renovate uses: renovatebot/github-action@v39.0.1 with: configurationFile: ${{ env.config }} From 51e100518b3c3cd751e6f8a30b26382fe896944f Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Fri, 11 Aug 2023 12:04:56 -0700 Subject: [PATCH 3/5] Comments and vars --- .github/workflows/renovate.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index 2cef2da..e37fc43 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -1,11 +1,13 @@ 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: + repo: # Optional input description: org/repo override (optional) type: string required: false @@ -15,10 +17,13 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true +# Variables +env: + config: renovate.json + pr_repos: '["bcgov/nr-renovate", "bcgov/quickstart-openshift"]' + jobs: - renovate: - env: - config: renovate.json + Renovate: permissions: pull-requests: write runs-on: ubuntu-22.04 @@ -28,11 +33,9 @@ jobs: # 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: | cat <<< $(jq '.+= {"dryRun": "full"}' ${{ env.config }}) > ${{ env.config }} - cat <<< $(jq '. | .repositories = ${{ env.repos }}' ${{ 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 From af133ccb9fca5f2a2995ae0eb80c42be1d49f764 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Fri, 11 Aug 2023 12:05:48 -0700 Subject: [PATCH 4/5] Do not allow workflows in parallel (interrupt) --- .github/workflows/renovate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index e37fc43..d64fe4f 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -14,7 +14,7 @@ on: # PR open and close use the same group, allowing only one at a time concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.workflow }} cancel-in-progress: true # Variables From f133da824ebefcf90f650279e60f07d1878c5e62 Mon Sep 17 00:00:00 2001 From: Derek Roberts Date: Fri, 11 Aug 2023 12:15:04 -0700 Subject: [PATCH 5/5] Comments --- .github/workflows/renovate.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/renovate.yml b/.github/workflows/renovate.yml index d64fe4f..b2caafa 100644 --- a/.github/workflows/renovate.yml +++ b/.github/workflows/renovate.yml @@ -12,7 +12,7 @@ on: 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 }} cancel-in-progress: true @@ -20,7 +20,7 @@ concurrency: # Variables env: config: renovate.json - pr_repos: '["bcgov/nr-renovate", "bcgov/quickstart-openshift"]' + pr_set: '["bcgov/nr-renovate", "bcgov/quickstart-openshift"]' jobs: Renovate: @@ -34,14 +34,16 @@ jobs: - 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_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