Automated dependency updates for Expedite #75
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: Manage artifacts to retain four recent artifacts | |
on: [push] | |
jobs: | |
ci-wipe: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Manage artifacts to retain four recent artifacts | |
run: | | |
KEEP_QANT=4 | |
ARTIFACT_UNIT=$(gh api repos/gridhead/expedite/actions/artifacts --paginate --jq '.artifacts | sort_by(.created_at) | .[].id') | |
ARTIFACT_LIST=($ARTIFACT_UNIT) | |
WIPE_QANT=$((${#ARTIFACT_LIST[@]} - $KEEP_QANT)) | |
if [ $WIPE_QANT -gt 0 ]; then | |
for item in $(seq 0 $(($WIPE_QANT - 1))); do | |
ARTIFACT_ID=${ARTIFACT_LIST[$item]} | |
echo "Deleting artifact ID $ARTIFACT_ID..." | |
gh api repos/gridhead/expedite/actions/artifacts/$ARTIFACT_ID -X DELETE | |
done | |
else | |
echo "No artifacts available." | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GHBTOKEN }} |