Skip to content

Commit

Permalink
Merge pull request #22 from RagnarokResearchLab/release-cleanup-script
Browse files Browse the repository at this point in the history
Add a cleanup script to semi-automatically delete outdated snapshots
  • Loading branch information
rdw-software authored Oct 29, 2024
2 parents 48ab1d3 + 9a850cb commit 33a5358
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions delete-old-snapshots.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
set -eu

test $GH_TOKEN # Mandatory
echo "Using GitHub token: $GH_TOKEN"

# Local tags may be out of sync (just delete any offenders)
git fetch --prune --prune-tags origin

# Delete all but the latest snapshot (no point in storing them)
OUTDATED_RELEASE_TAGS=$(git tag --sort=-creatordate | tail -n +2)
TAG_COUNT=$(git tag --sort=-creatordate | tail -n +2 | wc -l)

echo "Found $TAG_COUNT outdated release tags"

for TAG in $OUTDATED_RELEASE_TAGS; do
echo "Deleting tagged release $TAG"
gh release delete "$TAG" --yes --cleanup-tag
done

0 comments on commit 33a5358

Please sign in to comment.