actions/workspace/action.yaml

24 lines
670 B
YAML
Raw Normal View History

2023-11-23 16:22:05 -05:00
name: Link Workspace
desciption: Connect persistant storage to workspace
2023-11-23 15:30:34 -05:00
2023-11-23 17:18:02 -05:00
inputs:
key:
type: string
required: false
default: ${{ github.run_id }}
2023-11-23 15:30:34 -05:00
runs:
2023-11-23 15:39:16 -05:00
using: composite
2023-11-23 15:30:34 -05:00
steps:
- run: |
2023-11-23 17:18:02 -05:00
PERSISTANT="/cache/workspace/${{ inputs.key }}"
2023-11-23 17:12:04 -05:00
mkdir -p "$PERSISTANT"
2023-11-23 15:49:33 -05:00
WORKSPACE=$(pwd)
2023-11-23 16:46:10 -05:00
cd ..
2023-11-23 17:21:17 -05:00
rm -rf "$WORKSPACE" || sleep 5 && rm -rf "$WORKSPACE" || sleep 5 && rm -rf "$WORKSPACE"
2023-11-23 17:12:04 -05:00
ln -fs "$PERSISTANT" "$WORKSPACE"
echo "Linked: $PERSISTANT -> $WORKSPACE"
echo "Workspace will be automatically deleted in 1 hour"
sleep 3600 && rm -rf "$PERSISTANT" &
2023-11-23 17:16:12 -05:00
shell: sh