mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-11 18:32:23 +08:00
workflows/labels: fix stale label date sorting
With the help of:
https://stackabuse.com/how-to-sort-an-array-by-date-in-javascript/
(cherry picked from commit c9257371dc)
This commit is contained in:
4
.github/workflows/labels.yml
vendored
4
.github/workflows/labels.yml
vendored
@@ -246,8 +246,8 @@ jobs:
|
||||
'unmarked_as_duplicate',
|
||||
].includes(event))
|
||||
.map(({ created_at, updated_at, committer, submitted_at }) => new Date(updated_at ?? created_at ?? submitted_at ?? committer.date))
|
||||
.sort()
|
||||
.reverse()
|
||||
// Reverse sort by date value. The default sort() sorts by string representation, which is bad for dates.
|
||||
.sort((a,b) => b-a)
|
||||
.at(0) ?? item.created_at
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user