Skip to content

trackNodeMigration #101

trackNodeMigration

trackNodeMigration #101

name: trackNodeMigration
on:
workflow_dispatch:
inputs:
months:
description: 'Delete branches older than N months (preview only)'
required: true
default: '60'
jobs:
preview-branch-deletion:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: List branches older than N months (preview)
env:
MONTHS: ${{ github.event.inputs.months }}
run: |
set -e
echo "Preview: Branches older than $MONTHS months (excluding master and release branches):"
# Get cutoff date
cutoff=$(date -d "-$MONTHS months" +%s)
# List all remote branches except master and release
git for-each-ref --format='%(refname:short) %(committerdate:unix)' refs/remotes/ | while read branch date; do
# Remove 'origin/' prefix
bname=${branch#origin/}
# Skip master and release branches
if [[ "$bname" == "master" ]] || [[ "$bname" == release* ]]; then
continue
fi
if [[ $date -lt $cutoff ]]; then
echo "$bname (last commit: $(date -d @$date +%Y-%m-%d))"
fi
done