Merge and Delete Renovate Branch #248
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: Merge and Delete Renovate Branch | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Runs daily at midnight | |
workflow_dispatch: | |
inputs: | |
mergeNow: | |
description: 'Merge and delete Renovate branches manually' | |
default: 'false' | |
required: false | |
jobs: | |
merge-and-delete-renovate-branch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Merge and Delete Renovate Branch | |
if: ${{ github.event.inputs.mergeNow == 'true' || github.event_name == 'schedule' }} | |
run: | | |
# Get all open pull requests | |
PR_LIST=$(gh pr list --json state:open --jq '.[] | select(.head.ref | startswith("renovate/")) | .number') | |
# Loop through each pull request and merge it | |
for PR in $PR_LIST; do | |
gh pr merge --auto $PR --delete-branch | |
done |