mirror of
https://github.com/RetroDECK/Cooker.git
synced 2024-11-21 21:05:37 +00:00
WORKFLOW: excluding latest release from the release cleaner
This commit is contained in:
parent
b1a5336328
commit
154740b625
13
.github/workflows/delete-old-releases.yml
vendored
13
.github/workflows/delete-old-releases.yml
vendored
|
@ -27,8 +27,19 @@ jobs:
|
|||
ALL_RELEASES=$(curl -s -H "Authorization: token $GITHUB_TOKEN" "https://api.github.com/repos/$GITHUB_REPOSITORY/releases?per_page=100&page=1")
|
||||
PAGE_COUNT=$(echo "$ALL_RELEASES" | jq '. | length')
|
||||
|
||||
# Loop through pages and get releases older than 1 month
|
||||
# Get the latest release ID
|
||||
LATEST_RELEASE=$(echo "$ALL_RELEASES" | jq -r '.[0].id')
|
||||
|
||||
# Loop through pages and get releases older than 1 month (excluding the latest)
|
||||
for ((i=0; i<$PAGE_COUNT; i++)); do
|
||||
RELEASE_ID=$(echo "$ALL_RELEASES" | jq -r ".[$i].id")
|
||||
|
||||
# Skip the latest release
|
||||
if [ "$RELEASE_ID" == "$LATEST_RELEASE" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Check if the release is older than 1 month
|
||||
OLD_RELEASES=$(echo "$ALL_RELEASES" | jq --arg threshold "$THRESHOLD_DATE" ".[$i] | select(.published_at < \$threshold) | .id")
|
||||
|
||||
# Delete old releases
|
||||
|
|
Loading…
Reference in a new issue