-
Notifications
You must be signed in to change notification settings - Fork 80
40 lines (36 loc) · 1.12 KB
/
stale-branches.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Delete abandoned branches
on:
pull_request:
branches: ["main"]
paths:
- ".github/workflows/stale-branches.yaml"
# Run daily at midnight
schedule:
- cron: "0 0 * * *"
# Allow workflow to be manually run from the GitHub UI
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
cleanup-old-branches:
runs-on: ubuntu-latest
name: Satisfy my repo CDO
env:
DRY_RUN: no
steps:
- name: Set dry run
if: ${{ github.event_name == 'pull_request' }}
run: echo "DRY_RUN=yes" >> $GITHUB_ENV
- name: Delete those pesky dead branches
uses: phpdocker-io/github-actions-delete-abandoned-branches@v2
id: delete_stuff
with:
github_token: ${{ github.token }}
last_commit_age_days: 90
ignore_branches: main
# Disable dry run and actually get stuff deleted
# For a PR, always perform dry run
dry_run: ${{ env.DRY_RUN }}
- name: Get output
run: "echo 'Deleted branches: ${{ steps.delete_stuff.outputs.deleted_branches }}'"