From c9257371dc8bc0a2f1e2c65997d2cc4a5ad7996e Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Wed, 25 Jun 2025 09:44:33 +0200 Subject: [PATCH] workflows/labels: fix stale label date sorting With the help of: https://stackabuse.com/how-to-sort-an-array-by-date-in-javascript/ --- .github/workflows/labels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index 9c664d9c11f9..1aa46d751206 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -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 )