From f4ce7910dcd2a385851c17f021cef0de6b4a3d2d Mon Sep 17 00:00:00 2001 From: Hugh Hackman Date: Wed, 22 Apr 2026 14:26:57 +0000 Subject: [PATCH] fix: correct merge detection and branch pattern in stale-release-cleanup - Use git merge-base --is-ancestor instead of git log --merges --ancestry-path for reliable merge detection (works with squash merges and rebases) - Narrow v* glob to v[0-9]* to avoid matching vendor/ or similar Co-Authored-By: Claude Opus 4.7 --- .github/workflows/stale-release-cleanup.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/stale-release-cleanup.yaml b/.github/workflows/stale-release-cleanup.yaml index 73b984d..05609de 100644 --- a/.github/workflows/stale-release-cleanup.yaml +++ b/.github/workflows/stale-release-cleanup.yaml @@ -32,7 +32,7 @@ jobs: DAYS=14 # Find release branches older than 14 days not on main - for branch in $(git for-each-ref --format '%(refname:short)' 'refs/heads/release/*' 'refs/heads/v*'); do + for branch in $(git for-each-ref --format '%(refname:short)' 'refs/heads/release/*' 'refs/heads/v[0-9]*'); do ts=$(git log -1 --format='%ct' "$branch") if [ -z "$ts" ]; then continue @@ -41,7 +41,7 @@ jobs: if [ "$age_days" -gt "$DAYS" ]; then # Check if branch has been merged into main - if git log --merges --ancestry-path "$branch..main" --oneline 2>/dev/null | grep -q .; then + if git merge-base --is-ancestor "$branch" main 2>/dev/null; then echo "Merged branch found: $branch (age: ${age_days}d)" if [ "$DRY_RUN" != "true" ]; then echo "Deleting merged branch: $branch" @@ -60,4 +60,4 @@ jobs: echo "" echo "Release branches found:" git for-each-ref --format '%(refname:short) - %(committerdate:relative)' \ - 'refs/heads/release/*' 'refs/heads/v*' 2>/dev/null || echo "None found" \ No newline at end of file + 'refs/heads/release/*' 'refs/heads/v[0-9]*' 2>/dev/null || echo "None found" \ No newline at end of file