Skip to content

Commit 8658eb3

Browse files
committed
.github: workflows: build: add cleanup job before build
Add a `cleanup` job that runs before `build` to prune stale Docker resources and old `/tmp` entries on the self-hosted runner. This prevents disk space issues from accumulating CI leftovers. Signed-off-by: Simen S. Røstad <simen.rostad@nordicsemi.no>
1 parent 50e5728 commit 8658eb3

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

.github/workflows/build.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,22 @@ concurrency:
1414
cancel-in-progress: true
1515

1616
jobs:
17+
cleanup:
18+
runs-on: self-hosted
19+
steps:
20+
- name: Prune old Docker resources
21+
run: docker system prune --force --filter "until=48h"
22+
23+
- name: Remove stale runner temp entries
24+
run: |
25+
# GitHub Actions stores per-job temp files under _work/_temp.
26+
runner_temp_root="$(dirname "${RUNNER_TEMP}")"
27+
find "$runner_temp_root" -mindepth 1 -maxdepth 1 -mmin +2880 \
28+
! -path "$RUNNER_TEMP" \
29+
-exec rm -rf {} + 2>/dev/null || true
30+
1731
build:
32+
needs: cleanup
1833
runs-on: self-hosted
1934
container: ghcr.io/zephyrproject-rtos/ci:v0.29.2
2035
env:

0 commit comments

Comments
 (0)