Remove old nightly releases #676
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
# Removes old nightly releases | |
name: Remove old nightly releases | |
on: | |
workflow_dispatch: # for testing changes to this workflow | |
# Run nightly at 0500 UTC. | |
schedule: | |
- cron: '0 5 * * *' | |
jobs: | |
remove-old-releases: | |
name: Remove old nightly releases | |
runs-on: ubuntu-latest | |
steps: | |
- name: Remove all but last 10 releases | |
env: | |
GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' | |
shell: bash | |
run: | | |
RELEASES=`gh release list --repo dsp-testing/codeql-cli-nightlies | grep "Pre-release" | sed '1,10d' | cut -f 3` | |
echo "$RELEASES" | awk NF | tr '\n' '\0' | xargs --no-run-if-empty -0 -n1 gh release delete --repo dsp-testing/codeql-cli-nightlies --yes | |
echo "$RELEASES" | awk NF | sed 's/^/\/repos\/dsp-testing\/codeql-cli-nightlies\/git\/refs\/tags\//' | tr '\n' '\0' | xargs --no-run-if-empty -0 -n1 gh api -X DELETE --silent |