File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 22 to_remove :
33 type : string
44 default :
5+ background :
6+ type : boolean
7+ default : true
8+ description : " Run removal commands in background (true) or foreground (false). When true, returns immediately with PIDs as outputs."
59
10+ outputs :
11+ pids :
12+ description : " Space-separated list of background process PIDs (only set when background: true)"
13+ value : ${{ steps.remove_cruft.outputs.pids }}
614
715runs :
816 using : composite
@@ -17,11 +25,23 @@ runs:
1725 else
1826 TO_REMOVE=(${DEFAULT_DIRECTORIES})
1927 fi
28+ if [[ "${{ inputs.background }}" == "true" ]]; then
29+ # Run rm commands in background
30+ pids=()
31+ for removal in "${TO_REMOVE[@]}"; do
32+ echo "Removing: ${removal} (background) ..."
33+ sudo rm -rf "$removal" &
34+ pids+=($!)
35+ done
36+ echo "pids=${pids[*]}" >> $GITHUB_OUTPUT
37+ echo "Background removal started with PIDs: ${pids[*]}"
38+ exit 0
39+ fi
40+ # Run rm commands in foreground
2041 for removal in "${TO_REMOVE[@]}"; do
2142 echo "Removing: ${removal} ..."
2243 sudo rm -rf "$removal"
2344 done
24-
2545 echo "Disk after cruft removal"
2646 df -h
2747 env :
You can’t perform that action at this time.
0 commit comments