Skip to content

Prune merged preview branches #19

Prune merged preview branches

Prune merged preview branches #19

name: Prune merged preview branches
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
prune_branches:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout current repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Run prune_branches script
run: |
BRANCHES=($(git branch -r | sed 's/^[[:space:]]*origin\///'))
if [ ${#BRANCHES[@]} -gt 0 ]; then
./prune_merged_preview_branches.sh "${BRANCHES[@]}"
else
echo "No branches to prune."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}