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

ci(renovate): enhance the shared workflow #264

Merged
merged 9 commits into from
Oct 6, 2024
7 changes: 7 additions & 0 deletions .changeset/lazy-boats-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@bfra.me/.github": minor
---

* Add support for Renovating any PR that uses the `renovate` label

* Add a `path_filter` input for configuring the paths to filter for changes
25 changes: 16 additions & 9 deletions .github/workflows/renovate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ name: Renovate
issues:
types: [edited]
pull_request:
types: [edited]
types: [edited, labeled]
push:
branches: ['**']
schedule:
Expand All @@ -17,6 +17,9 @@ name: Renovate
description: Log level
type: string
default: debug
path_filters:
description: List of paths to filter for checking for changes
type: string
print_config:
description: Log the fully-resolved Renovate config for each repository, plus fully-resolved presets.
type: boolean
Expand All @@ -37,6 +40,9 @@ name: Renovate
description: Log level
type: string
default: debug
path_filters:
description: List of paths to filter for checking for changes
type: string
print_config:
description: Log the fully-resolved Renovate config for each repository, plus fully-resolved presets.
type: boolean
Expand All @@ -54,6 +60,7 @@ jobs:
name: Renovate
if: >-
(github.event_name != 'issues' && github.event_name != 'pull_request') ||
(github.event_name != 'issues' && contains(github.event.*.labels.*.name, 'renovate')) ||
(
contains(join(github.event.*.body, ''), '- [x] <!-- approve-all-pending-prs -->') ||
contains(join(github.event.*.body, ''), '- [x] <!-- approve-branch=') ||
Expand All @@ -70,6 +77,8 @@ jobs:
contains(join(github.event.*.body, ''), '- [x] <!-- unschedule-branch=')
)
env:
has_renovate_label: ${{ github.event_name != 'issues' && contains(github.event.*.labels.*.name, 'renovate') }}
default_path_filters: "['.github/workflows/renovate.yaml', '.github/renovate.json5']"
WORKFLOW_LOG_LEVEL: debug
runs-on: ubuntu-latest
steps:
Expand All @@ -80,23 +89,21 @@ jobs:
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
with:
filters: |
changes:
- '.github/workflows/renovate.yaml'
- '.github/renovate.json5'
changes: ${{ inputs.path_filters != '' && inputs.path_filters || env.default_path_filters }}
- name: Renovate
env:
autodiscover: >-
${{ github.event.repository.name == '.github' && !contains('["issues", "pull_request"]', github.event_name) && github.ref == 'refs/heads/main' }}
dry_run: ${{ github.event_name == 'push' && github.ref != 'refs/heads/main' }}
if: github.event_name != 'push' || steps.filter.outputs.changes == 'true'
dry_run: ${{ env.has_renovate_label == 'false' && github.event_name == 'push' && github.ref != 'refs/heads/main' }}
if: github.event_name != 'push' || steps.filter.outputs.changes == 'true' || env.has_renovate_label == 'true'
uses: bfra-me/renovate-action@v4
with:
autodiscover: ${{ env.autodiscover }}
branch: ${{ env.dry_run == 'true' && github.ref_name || '' }}
branch: ${{ (( env.has_renovate_label == 'true' && github.ref_name != github.event.repository.default_branch ) || env.dry_run == 'true' ) && github.ref_name || '' }}
cache: true
dry-run: ${{ env.dry_run }}
log-level: ${{ inputs.log_level || env.WORKFLOW_LOG_LEVEL }}
print-config: ${{ inputs.print_config || github.event_name == 'push' }}
print-config: ${{ inputs.print_config }}
renovate-app-id: ${{ secrets.APPLICATION_ID }}
renovate-app-private-key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
timeout-minutes: 30
timeout-minutes: 15