forked from NMRLipids/BilayerData
-
Notifications
You must be signed in to change notification settings - Fork 0
33 lines (28 loc) · 1002 Bytes
/
NREC-Cleanup.yml
File metadata and controls
33 lines (28 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: Weekly NREC Workspace Cleanup
on:
schedule:
- cron: "0 3 * * 1"
workflow_dispatch:
jobs:
cleanup:
runs-on: [nrec-large]
steps:
- name: Wipe everything under _work
run: |
# Move two levels up from $GITHUB_WORKSPACE to reach _work directory
WORKDIR="$(dirname "$(dirname "$GITHUB_WORKSPACE")")"
echo "Detected workspace: $GITHUB_WORKSPACE"
echo "Resolved workdir: $WORKDIR"
echo
# Safety check: verify that the resolved directory name is "_work"
# before running deletion.
if [[ "$(basename "$WORKDIR")" == "_work" ]]; then
echo "Confirmed _work directory, proceeding with cleanup."
sudo find "$WORKDIR" -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +
else
echo "Safety check failed — $WORKDIR is not named _work"
exit 1
fi
echo
echo "Cleanup complete. Current disk usage:"
df -h