File tree 2 files changed +33
-2
lines changed
2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 30
30
with :
31
31
build-mount-path : /var/lib/docker/tmp
32
32
33
+ test-mount-parent-of-workspace :
34
+ name : Test mounting the parent of GITHUB_WORKSPACE
35
+ runs-on : ubuntu-latest
36
+ steps :
37
+ - name : Check out Maximize Build Space action
38
+ uses : actions/checkout@v4
39
+ with :
40
+ path : ./.github/actions/maximize-test
41
+
42
+ - name : Calculate parent of workspace
43
+ id : workspace-parent
44
+ run : echo "parent=$(dirname "${GITHUB_WORKSPACE}")" >> "$GITHUB_OUTPUT"
45
+
46
+ - name : Maximize build space
47
+ uses : ./.github/actions/maximize-test
48
+ with :
49
+ build-mount-path : ${{ steps.workspace-parent.outputs.parent }}
50
+
51
+ - name : Create file in build folder as runner user (test ownership)
52
+ run : |
53
+ mkdir -p ${{ steps.workspace-parent.outputs.parent }}/new
54
+ touch ${{ steps.workspace-parent.outputs.parent }}/new/file.txt
55
+ touch ${GITHUB_WORKSPACE}/file.txt
56
+ ls -alR ${{ steps.workspace-parent.outputs.parent }}
57
+
33
58
determine-free-space :
34
59
name : Determine free space with different settings
35
60
runs-on : ${{ matrix.os }}
Original file line number Diff line number Diff line change @@ -111,6 +111,9 @@ runs:
111
111
fi
112
112
echo
113
113
114
+ # store owner of $GITHUB_WORKSPACE in case the action deletes it
115
+ WORKSPACE_OWNER="$(stat -c '%U:%G' "${GITHUB_WORKSPACE}")"
116
+
114
117
# ensure mount path exists before the action
115
118
sudo mkdir -p "${BUILD_MOUNT_PATH}"
116
119
sudo find "${BUILD_MOUNT_PATH}" -maxdepth 0 ! -empty -exec echo 'WARNING: directory [{}] is not empty, data loss might occur. Content:' \; -exec ls -al "{}" \;
@@ -182,8 +185,11 @@ runs:
182
185
sudo mount "/dev/mapper/${VG_NAME}-buildlv" "${BUILD_MOUNT_PATH}"
183
186
sudo chown -R "${{ inputs.build-mount-path-ownership }}" "${BUILD_MOUNT_PATH}"
184
187
185
- # if build mount path is a parent of $GITHUB_WORKSPACE, recreate it
186
- sudo mkdir -p "${GITHUB_WORKSPACE}"
188
+ # if build mount path is a parent of $GITHUB_WORKSPACE, and has been deleted, recreate it
189
+ if [[ ! -d "${GITHUB_WORKSPACE}" ]]; then
190
+ sudo mkdir -p "${GITHUB_WORKSPACE}"
191
+ sudo chown -R "${WORKSPACE_OWNER}" "${GITHUB_WORKSPACE}"
192
+ fi
187
193
188
194
- name : Disk space report after modification
189
195
shell : bash
You can’t perform that action at this time.
0 commit comments