Create workfolder #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cleanup Workflow | |
on: | |
push: | |
workflow_dispatch: | |
inputs: | |
runner_name: | |
description: 'Select the self-hosted runner to clean' | |
required: true | |
default: 'n150-5' | |
purge_docker: | |
description: 'Purge docker images' | |
required: true | |
default: 'true' | |
type: boolean | |
delete_workspace: | |
description: 'Delete the workspace' | |
required: true | |
default: 'false' | |
type: boolean | |
jobs: | |
cleanup: | |
# runs-on: ${{ github.event.inputs.runner_name }} | |
runs-on: n150 | |
steps: | |
- name: Report free space before cleanup | |
run: | | |
echo "Free space before cleanup:" | |
df -h | |
- name: Purge all Docker cached images | |
# if: ${{ github.event.inputs.delete_workspace }} | |
run: | | |
echo "Removing all unused Docker images..." | |
docker system prune -fa | |
echo "Docker images purged." | |
- name: Delete work folder | |
# if: ${{ github.event.inputs.delete_workspace }} | |
run: | | |
export WORKPLACE=/home/ubuntu/actions-runner/_work | |
echo "Deleting work folder $WORKPLACE" | |
sudo rm -rf $WORKPLACE | |
mkdir -p $GITHUB_WORKSPACE | |
- name: Report free space after cleanup | |
run: | | |
echo "Free space after cleanup:" | |
df -h |