diff --git a/.github/workflows/stale-release-cleanup.yaml b/.github/workflows/stale-release-cleanup.yaml index 2d43cf6..19f5481 100644 --- a/.github/workflows/stale-release-cleanup.yaml +++ b/.github/workflows/stale-release-cleanup.yaml @@ -33,8 +33,8 @@ 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[0-9]*'); do - ts=$(git log -1 --format='%ct' "$branch") + for branch in $(git for-each-ref --format '%(refname:strip=3)' 'refs/remotes/origin/release/*' 'refs/remotes/origin/v[0-9]*'); do + ts=$(git log -1 --format='%ct' "refs/remotes/origin/$branch") if [ -z "$ts" ]; then continue fi @@ -42,7 +42,7 @@ jobs: if [ "$age_days" -gt "$DAYS" ]; then # Check if branch has been merged into main - if git merge-base --is-ancestor "$branch" main 2>/dev/null; then + if git merge-base --is-ancestor "refs/remotes/origin/$branch" main 2>/dev/null; then echo "Merged branch found: $branch (age: ${age_days}d)" if [ "$DRY_RUN" == "true" ]; then echo "Would delete merged branch: $branch" @@ -62,5 +62,5 @@ jobs: echo "Dry run complete. No branches were deleted." echo "" echo "Release branches found:" - git for-each-ref --format '%(refname:short) - %(committerdate:relative)' \ - 'refs/heads/release/*' 'refs/heads/v[0-9]*' 2>/dev/null || echo "None found" \ No newline at end of file + git for-each-ref --format '%(refname:strip=3) - %(committerdate:relative)' \ + 'refs/remotes/origin/release/*' 'refs/remotes/origin/v[0-9]*' 2>/dev/null || echo "None found" \ No newline at end of file