Skip to content

Commit 2003063

Browse files
feat(cleanup-branches): input logic and error handling improvements (#1395)
add handling for when no branches qualify for deletion swap handling for inputs.dry-run so that any unknown input value will default to dry-run
1 parent 99728c5 commit 2003063

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

actions/cleanup-branches/action.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,19 @@ runs:
7373
done
7474
- name: Delete branches (dry run)
7575
shell: bash
76-
if: ${{ inputs.dry-run == 'true' }}
76+
if: ${{ inputs.dry-run != 'false' }}
7777
run: |
78+
if [[ ! -s branches.txt ]]; then
79+
echo "🟢 No branches marked for deletion."
80+
exit 0
81+
fi
7882
cat branches.txt | xargs -I {} echo git push origin --delete "{}"
7983
- name: Delete branches
8084
shell: bash
81-
if: ${{ inputs.dry-run != 'true' }}
85+
if: ${{ inputs.dry-run == 'false' }}
8286
run: |
87+
if [[ ! -s branches.txt ]]; then
88+
echo "🟢 No branches marked for deletion."
89+
exit 0
90+
fi
8391
cat branches.txt | xargs -I {} git push origin --delete "{}"

0 commit comments

Comments
 (0)