mirror of
https://github.com/jlumbroso/free-disk-space.git
synced 2026-01-28 21:59:07 +08:00
Add Docker image removal option
This commit is contained in:
@@ -32,6 +32,7 @@ jobs:
|
||||
dotnet: true
|
||||
haskell: true
|
||||
large-packages: true
|
||||
docker-images: true
|
||||
swap-storage: true
|
||||
```
|
||||
## Options
|
||||
@@ -49,6 +50,7 @@ Here are a few sources of inspiration:
|
||||
- https://github.com/apache/flink/blob/master/tools/azure-pipelines/free_disk_space.sh
|
||||
- https://github.com/ShubhamTatvamasi/free-disk-space-action
|
||||
- https://github.com/actions/virtual-environments/issues/2875#issuecomment-1163392159
|
||||
- https://github.com/easimon/maximize-build-space/
|
||||
|
||||
## Typical Output
|
||||
|
||||
|
||||
17
action.yml
17
action.yml
@@ -27,6 +27,11 @@ inputs:
|
||||
required: false
|
||||
default: "true"
|
||||
|
||||
docker-images:
|
||||
description: "Remove Docker images"
|
||||
required: false
|
||||
default: "true"
|
||||
|
||||
# option inspired by:
|
||||
# https://github.com/actions/virtual-environments/issues/2875#issuecomment-1163392159
|
||||
tool-cache:
|
||||
@@ -180,6 +185,18 @@ runs:
|
||||
printSavedSpace $SAVED "Large misc. packages"
|
||||
fi
|
||||
|
||||
# Option: Remove Docker images
|
||||
|
||||
if [[ ${{ inputs.docker-images }} == 'true' ]]; then
|
||||
BEFORE=$(getAvailableSpace)
|
||||
|
||||
sudo docker image prune --all --force
|
||||
|
||||
AFTER=$(getAvailableSpace)
|
||||
SAVED=$((AFTER-BEFORE))
|
||||
printSavedSpace $SAVED "Docker images"
|
||||
fi
|
||||
|
||||
# Option: Remove tool cache
|
||||
# REF: https://github.com/actions/virtual-environments/issues/2875#issuecomment-1163392159
|
||||
|
||||
|
||||
Reference in New Issue
Block a user