clean_build_artifacts.yml 768 B

1234567891011121314151617
  1. name: Clean build artifacts
  2. on:
  3. schedule:
  4. - cron: '0 10 * * *' # Once per day at 10am UTC
  5. jobs:
  6. main:
  7. runs-on: ubuntu-latest
  8. steps:
  9. - name: Delete artifacts in cron job
  10. env:
  11. GH_ACTIONS_REPO_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
  12. run: |
  13. echo "Running clean build artifacts logic"
  14. output=$(curl -X GET -H "Authorization: token $GH_ACTIONS_REPO_TOKEN" https://api.github.com/repos/spring-projects/spring-security/actions/artifacts | grep '"id"' | cut -d : -f2 | sed 's/,*$//g')
  15. echo Output is $output
  16. for id in $output; do curl -X DELETE -H "Authorization: token $GH_ACTIONS_REPO_TOKEN" https://api.github.com/repos/spring-projects/spring-security/actions/artifacts/$id; done;