Skip to content

Clean up artifacts #140

Clean up artifacts

Clean up artifacts #140

Workflow file for this run

name: Clean up artifacts
on:
schedule:
- cron: '0 0 * * *' # Esegue ogni domenica a mezzanotte
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Delete old artifacts
run: |
echo "Fetching artifact list..."
ARTIFACTS=$(gh api repos/Elemento-Modular-Cloud/elemento-gui/actions/artifacts --paginate | jq -r '.artifacts[] | select(.expired == false) | select(.created_at < (now - 604800 | todate)) | .id')
for ARTIFACT_ID in $ARTIFACTS; do
echo "Deleting artifact with ID $ARTIFACT_ID"
gh api repos/Elemento-Modular-Cloud/elemento-gui/actions/artifacts/$ARTIFACT_ID -X DELETE
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}