-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
36 lines (36 loc) · 1.35 KB
/
action.yml
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
34
35
36
name: 'mount-tmpfs'
description: 'Create and mount a temporary file system in memory'
inputs:
size:
description: FS size in MB (>= 1)
required: true
default: 1
root:
description: 'Root path for the mount point (default = working directory)'
required: true
default: '.'
outputs:
uuid:
description: 'Device uuid of the disk'
value: ${{ steps.create.outputs.uuid }}
mnt:
description: 'Mount path of the disk (=<root>/<uuid>)'
value: ${{ steps.create.outputs.mnt }}
runs:
using: "composite"
steps:
- name: Create
id: create
shell: bash
run: |
UUID="$(cat /proc/sys/kernel/random/uuid)"
MNT="${{ inputs.root }}/${UUID}"
echo ":rocket: Temp FS ${MNT} creation started" >> $GITHUB_STEP_SUMMARY
sudo mkdir -p "${MNT}" \
&& echo ":heavy_check_mark: Temp FS mount point creation succeeded" >> $GITHUB_STEP_SUMMARY \
|| { echo ":x: Temp FS mount point creation failed" >> $GITHUB_STEP_SUMMARY; exit 1; }
sudo mount -o size=${{ inputs.size }}M,uid=$(id -u) -t tmpfs tmpfs "${MNT}" \
&& echo ":heavy_check_mark: Temp FS mount operation succeeded" >> $GITHUB_STEP_SUMMARY \
|| { echo ":x: Temp FS mount operation failed" >> $GITHUB_STEP_SUMMARY; exit 1; }
echo "uuid=${UUID}" >> $GITHUB_OUTPUT
echo "mnt=${MNT}" >> $GITHUB_OUTPUT