Skip to content

Delete Stale Branches #6

Delete Stale Branches

Delete Stale Branches #6

# This is a GitHub action that will automatically delete any branches
# that aren't protected and haven't been committed to in over 6 months.
name: Delete Stale Branches
on:
workflow_dispatch:
inputs:
dry_run:
description: 'Run in dry-run mode (no branches will be deleted)'
required: false
type: boolean
default: false
permissions:
contents: read
jobs:
stale_branches:
permissions:
contents: write
name: Cleanup old branches
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # ratchet:actions/checkout@v2
- name: Run delete-old-branches-action
uses: beatlabs/delete-old-branches-action@db61ade054731e37b5740e23336445fbc75ccd7b # ratchet:beatlabs/delete-old-branches-action@v0.0.9
with:
repo_token: ${{ github.token }}
date: '6 months ago'
dry_run: ${{ inputs.dry_run }}
exclude_open_pr_branches: true
extra_protected_branch_regex: ^release/.*