Skip to content

Commit e901ef0

Browse files
committed
fix: use published_at instead of created_at for release sorting
When multiple releases are created in bulk, they have identical created_at timestamps, causing unstable sort order that may delete newer releases instead of older ones. Use published_at which reflects the actual release publication order.
1 parent abf2875 commit e901ef0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

.github/workflows/delete-old-releases.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ on:
3131
jobs:
3232
clean_releases:
3333
name: "Clean releases"
34-
runs-on: ubuntu-latest
34+
runs-on: Linux
3535
permissions:
3636
contents: write # required to delete releases (and tags if enabled)
3737

@@ -93,10 +93,10 @@ jobs:
9393
local keep="$2"
9494
local kind="$3"
9595
96-
# Build array of candidates sorted newest first by created_at
96+
# Build array of candidates sorted newest first by published_at
9797
# Keep fields we need (id, tag_name, name)
9898
candidates="$(echo "$releases_json" | jq -c "$jq_filter
99-
| sort_by(.created_at) | reverse
99+
| sort_by(.published_at) | reverse
100100
| map({id, tag_name, name})")"
101101
102102
total="$(echo "$candidates" | jq 'length')"

0 commit comments

Comments
 (0)