Cleanup artifacts base on the size limit to make sure the storage space is not exhausted.
This action helps you cleanup the oldest/newest artifacts when space is not enough for the pending upload artifacts.
limit | fixedReservedSize / calcalated size | removeDirection | Total size of existing artifacts | Behavior |
---|---|---|---|---|
10MB | 5MB | oldest | 6MB --> Artifact 1 (Older): 2MB, Artifact 2 (Newer): 4MB | Artifact 1 will be deleted |
10MB | 5MB | newest | 6MB --> Artifact 1 (Older): 2MB, Artifact 2 (Newer): 4MB | Artifact 2 will be deleted |
10MB | 5MB | oldest | 5MB --> Artifact 1 (Older): 2MB, Artifact 2 (Newer): 3MB | None (Space is enough to place new artifacts) |
10MB | 5MB | oldest | 4MB --> Artifact 1 (Older): 2MB, Artifact 2 (Newer): 2MB | None (Space is enough to place new artifacts) |
10MB | 5MB | oldest / newest | 9MB --> Artifact 1 (Older): 3MB, Artifact 2 (Newer): 6MB | Artifact 1 & Artifact 2 will be deleted |
10MB | 12MB | oldest / newest | Exception throw |
See also action.yml
- name: Run cleanup action
uses: zhuxb711/artifacts-size-based-cleanup-action@v1
with:
token: '<Your Github token>'
limit: 1GB
artifactPaths: <Your path to the files or directories that pending uploads>
- name: Run cleanup action
uses: zhuxb711/artifacts-size-based-cleanup-action@v1
with:
token: '<Your Github token>'
limit: 1GB
artifactPaths: |
<Path 1>
<Path 2>
<Path 3>
- name: Run cleanup action
uses: zhuxb711/artifacts-size-based-cleanup-action@v1
with:
token: '<Your Github token>'
limit: 1GB
fixedReservedSize: 512MB
- name: Run cleanup action
uses: zhuxb711/artifacts-size-based-cleanup-action@v1
with:
token: '<Your Github token>' # Token must be granted access permission with 'workflow' scope.
limit: 1GB # Could also set to 1024MB/512KB/2.5GB or size in bytes.
fixedReservedSize: 512MB # Optional. Fixed size you want to reserved for the new artifacts. Must set 'artifactPaths' or 'fixedReservedSize'.
failOnError: true # Optional. Reports failure if meet any exception.
removeDirection: oldest # Optional. Remove the oldest artifact first or the newest one first.
simulateCompressionLevel: 9 # Optional. Should be the same value as you specific in the upload artifacts action.
artifactPaths: <Your path to the files that pending uploads> # Optional. Must set 'artifactPaths' or 'fixedReservedSize'.