Skip to content

Commit 6ebda3a

Browse files
committed
🔧 fix(workflows): Improve cleanup branch workflow with enhanced logging for commit count and staleness reasons
1 parent 35ca66e commit 6ebda3a

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎.github/workflows/cleanup-branch.yml‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,20 @@ jobs:
5959
run: |
6060
NEED_CLEANUP=false
6161
REASON=""
62-
echo "[cleanup-branch] Commit count: ${{ steps.count.outputs.commit_count }} (threshold: ${{ inputs.commit_threshold }})"
63-
echo "[cleanup-branch] Days since last commit: ${{ steps.lastdate.outputs.age_days }} (threshold: ${{ inputs.days_stale }})"
64-
if [ "${{ steps.count.outputs.commit_count }}" -gt "${{ inputs.commit_threshold }}" ]; then
62+
COMMIT_COUNT="${{ steps.count.outputs.commit_count }}"
63+
DAYS_STALE="${{ steps.lastdate.outputs.age_days }}"
64+
echo "[cleanup-branch] Commit count: $COMMIT_COUNT (threshold: ${{ inputs.commit_threshold }})"
65+
echo "[cleanup-branch] Days since last commit: $DAYS_STALE (threshold: ${{ inputs.days_stale }})"
66+
if [ "$COMMIT_COUNT" -gt "${{ inputs.commit_threshold }}" ]; then
6567
NEED_CLEANUP=true
66-
REASON="Commit count (${ { steps.count.outputs.commit_count } }) exceeds threshold (${ { inputs.commit_threshold } })"
68+
REASON="Commit count ($COMMIT_COUNT) exceeds threshold (${{ inputs.commit_threshold }})"
6769
fi
68-
if [ "${{ steps.lastdate.outputs.age_days }}" -gt "${{ inputs.days_stale }}" ]; then
70+
if [ "$DAYS_STALE" -gt "${{ inputs.days_stale }}" ]; then
6971
NEED_CLEANUP=true
7072
if [ -n "$REASON" ]; then
7173
REASON="$REASON; "
7274
fi
73-
REASON+="Branch is stale (${ { steps.lastdate.outputs.age_days } } days > ${ { inputs.days_stale } })"
75+
REASON+="Branch is stale ($DAYS_STALE days > ${{ inputs.days_stale }})"
7476
fi
7577
if [ "$NEED_CLEANUP" = true ]; then
7678
echo "[cleanup-branch] Cleanup needed: true. Reason: $REASON"

0 commit comments

Comments
 (0)