mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-12 02:40:31 +08:00
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 f3b67f4eb5)
This commit is contained in:
committed by
github-actions[bot]
parent
3f9e119795
commit
7d50d6a984
18
.github/workflows/labels.yml
vendored
18
.github/workflows/labels.yml
vendored
@@ -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 ?? '<pending>')
|
||||
if (!run_id) return;
|
||||
if (log('Last eval run', run_id ?? '<pending>', !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 ?? '<not found>')
|
||||
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 ?? '<not found>', expired))
|
||||
return;
|
||||
|
||||
await artifactClient.downloadArtifact(artifact.id, {
|
||||
findBy: {
|
||||
|
||||
Reference in New Issue
Block a user