Skip to content

Commit 2100d65

Browse files
authored
add Cleanup Disk job (#41817)
1 parent 53691f6 commit 2100d65

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

.github/workflows/pre-commit-reuse.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,20 @@ jobs:
3131
- name: Install dependencies
3232
run: poetry install
3333

34+
- name: Cleanup Disk
35+
run: |
36+
USAGE=$(df / | tail -1 | awk '{print $5}' | sed 's/%//')
37+
df -h
38+
echo "Disk usage: ${USAGE}%"
39+
if [ "$USAGE" -gt 75 ]; then
40+
echo "Cleaning old Docker images"
41+
docker image prune -af --filter "until=24h" || true
42+
echo "Disk usage after cleanup:"
43+
df -h
44+
else
45+
echo "Disk usage below threshold, skipping cleanup."
46+
fi
47+
3448
- name: Cache Pre commit
3549
id: cache-pre-commit
3650
uses: actions/cache@v3

0 commit comments

Comments
 (0)