Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand All @@ -98,7 +99,7 @@ jobs:
direction: 'desc',
...prEventCondition
},
async (response, done) => await Promise.all(response.data.map(async (pull_request) => {
async (response, done) => (await Promise.allSettled(response.data.map(async (pull_request) => {
const log = (k,v) => core.info(`PR #${pull_request.number} - ${k}: ${v}`)

log('Last updated at', pull_request.updated_at)
Expand Down Expand Up @@ -136,7 +137,7 @@ jobs:
repositoryOwner: context.repo.owner,
token: core.getInput('github-token')
},
path: path.resolve('comparison'),
path: path.resolve(pull_request.number.toString()),
expectedHash: artifact.digest
})

Expand All @@ -160,11 +161,11 @@ jobs:
)

const maintainers = new Set(Object.keys(
JSON.parse(await readFile('comparison/maintainers.json', 'utf-8'))
JSON.parse(await readFile(`${pull_request.number}/maintainers.json`, 'utf-8'))
))

// And the labels that should be there
const after = JSON.parse(await readFile('comparison/changed-paths.json', 'utf-8')).labels
const after = JSON.parse(await readFile(`${pull_request.number}/changed-paths.json`, 'utf-8')).labels
if (approvals.size > 0) after.push(`12.approvals: ${approvals.size > 2 ? '3+' : approvals.size}`)
if (Array.from(maintainers).some(m => approvals.has(m))) after.push('12.approved-by: package-maintainer')

Expand All @@ -187,7 +188,9 @@ jobs:
labels: added
})
}
}))
})))
.filter(({ status }) => status == 'rejected')
.map(({ reason }) => core.setFailed(reason))
)

- uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
Expand Down