From f1fa19034fcbcfe9e7c3d93900a030ced8d28577 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Mon, 16 Jun 2025 15:55:40 +0200 Subject: [PATCH] workflows/labels: fix first scheduled run This would fail, because no previous workflow can be found. (cherry picked from commit 4425979533e2c2264613454739a77c55063cbbf2) --- .github/workflows/labels.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index 1a3571ac0212..6e025a8a36ce 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -69,13 +69,14 @@ jobs: // Normally a scheduled run, but could be workflow_dispatch, see above. Go back as far // as the last successful run of this workflow to make sure we are not leaving anyone // behind on GHA failures. + // Defaults to go back 1 hour on the first run. return (await github.rest.actions.listWorkflowRuns({ ...context.repo, workflow_id: 'labels.yml', event: 'schedule', status: 'success', exclude_pull_requests: true - })).data.workflow_runs[0]?.created_at + })).data.workflow_runs[0]?.created_at ?? new Date().getTime() - 1 * 60 * 60 * 1000 })()) core.info('cutoff timestamp: ' + cutoff.toISOString())