From 848bddaff05df3bb2be178286c839a052271ea8a Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Tue, 17 Jun 2025 14:01:45 +0200 Subject: [PATCH] workflows/labels: improve logging for skipped PRs Conditions that cause a PR to be skipped are now marked clearly in the log output. (cherry picked from commit f3b67f4eb5a1f757a0e784f6197e14a9d9cbcd80) --- .github/workflows/labels.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/labels.yml b/.github/workflows/labels.yml index d1d846aa9fa1..ce126788ea69 100644 --- a/.github/workflows/labels.yml +++ b/.github/workflows/labels.yml @@ -128,10 +128,13 @@ jobs: }, async (response, done) => (await Promise.allSettled(response.data.map(async (pull_request) => { try { - const log = (k,v) => core.info(`PR #${pull_request.number} - ${k}: ${v}`) + const log = (k,v,skip) => { + core.info(`PR #${pull_request.number} - ${k}: ${v}` + (skip ? ' (skipped)' : '')) + return skip + } - log('Last updated at', pull_request.updated_at) - if (new Date(pull_request.updated_at) < cutoff) return done() + if (log('Last updated at', pull_request.updated_at, new Date(pull_request.updated_at) < cutoff)) + return done() log('URL', pull_request.html_url) const run_id = (await github.rest.actions.listWorkflowRuns({ @@ -146,8 +149,8 @@ jobs: // Newer PRs might not have run Eval to completion, yet. We can skip them, because this // job will be run as part of that Eval run anyway. - log('Last eval run', run_id ?? '') - if (!run_id) return; + if (log('Last eval run', run_id ?? '', !run_id)) + return; const artifact = (await github.rest.actions.listWorkflowRunArtifacts({ ...context.repo, @@ -159,8 +162,9 @@ jobs: // actually download the artifact in the next step and avoid that race condition. // Older PRs, where the workflow run was already eval.yml, but the artifact was not // called "comparison", yet, will be skipped as well. - log('Artifact expires at', artifact?.expires_at ?? '') - if (new Date(artifact?.expires_at ?? 0) < new Date(new Date().getTime() + 60 * 1000)) return; + const expired = new Date(artifact?.expires_at ?? 0) < new Date(new Date().getTime() + 60 * 1000) + if (log('Artifact expires at', artifact?.expires_at ?? '', expired)) + return; await artifactClient.downloadArtifact(artifact.id, { findBy: {