mirror of
https://github.com/dorny/test-reporter.git
synced 2026-03-21 23:52:12 +01:00
Rebuild the dist/index.js file
This commit is contained in:
parent
8446e5e701
commit
2c50ce608c
1 changed files with 11 additions and 1 deletions
12
dist/index.js
generated
vendored
12
dist/index.js
generated
vendored
|
|
@ -2947,8 +2947,18 @@ function getCheckRunContext() {
|
||||||
if (!event.workflow_run) {
|
if (!event.workflow_run) {
|
||||||
throw new Error("Event of type 'workflow_run' is missing 'workflow_run' field");
|
throw new Error("Event of type 'workflow_run' is missing 'workflow_run' field");
|
||||||
}
|
}
|
||||||
|
const prs = event.workflow_run.pull_requests ?? [];
|
||||||
|
// For `workflow_run`, we want to report against the PR commit when possible so annotations land
|
||||||
|
// on the contributor's changes. Prefer the PR whose `head.ref` matches `workflow_run.head_branch`,
|
||||||
|
// then fall back to the first PR head SHA, and finally to `workflow_run.head_sha` for non-PR runs.
|
||||||
|
const prShaMatch = prs.find(pr => pr.head?.ref === event.workflow_run.head_branch)?.head?.sha;
|
||||||
|
const prShaFirst = prs[0]?.head?.sha;
|
||||||
|
const sha = prShaMatch ?? prShaFirst ?? event.workflow_run.head_sha;
|
||||||
|
if (!sha) {
|
||||||
|
throw new Error('Unable to resolve SHA from workflow_run (no PR head.sha or head_sha)');
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
sha: event.workflow_run.head_commit.id,
|
sha,
|
||||||
runId: event.workflow_run.id
|
runId: event.workflow_run.id
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue