mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 06:17:10 +01:00
Improve logging & fix wrong SHA used
This commit is contained in:
parent
c5671cf48a
commit
96237b3119
3 changed files with 7 additions and 3 deletions
4
dist/index.js
generated
vendored
4
dist/index.js
generated
vendored
|
|
@ -1378,6 +1378,7 @@ const got_1 = __importDefault(__nccwpck_require__(3061));
|
||||||
const asyncStream = util_1.promisify(stream.pipeline);
|
const asyncStream = util_1.promisify(stream.pipeline);
|
||||||
function getCheckRunContext() {
|
function getCheckRunContext() {
|
||||||
if (github.context.eventName === 'workflow_run') {
|
if (github.context.eventName === 'workflow_run') {
|
||||||
|
core.info('Action was triggered by workflow_run: using SHA and RUN_ID from triggering workflow');
|
||||||
const event = github.context.payload;
|
const event = github.context.payload;
|
||||||
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");
|
||||||
|
|
@ -1388,7 +1389,8 @@ function getCheckRunContext() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const runId = github.context.runId;
|
const runId = github.context.runId;
|
||||||
if (github.context.eventName === 'pullrequest' && github.context.payload.pull_request) {
|
if (github.context.payload.pull_request) {
|
||||||
|
core.info(`Action was triggered by ${github.context}: using SHA from head of source branch`);
|
||||||
const pr = github.context.payload.pull_request;
|
const pr = github.context.payload.pull_request;
|
||||||
return { sha: pr.head.sha, runId };
|
return { sha: pr.head.sha, runId };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -10,6 +10,7 @@ const asyncStream = promisify(stream.pipeline)
|
||||||
|
|
||||||
export function getCheckRunContext(): {sha: string; runId: number} {
|
export function getCheckRunContext(): {sha: string; runId: number} {
|
||||||
if (github.context.eventName === 'workflow_run') {
|
if (github.context.eventName === 'workflow_run') {
|
||||||
|
core.info('Action was triggered by workflow_run: using SHA and RUN_ID from triggering workflow')
|
||||||
const event = github.context.payload as EventPayloads.WebhookPayloadWorkflowRun
|
const event = github.context.payload as EventPayloads.WebhookPayloadWorkflowRun
|
||||||
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")
|
||||||
|
|
@ -21,7 +22,8 @@ export function getCheckRunContext(): {sha: string; runId: number} {
|
||||||
}
|
}
|
||||||
|
|
||||||
const runId = github.context.runId
|
const runId = github.context.runId
|
||||||
if (github.context.eventName === 'pullrequest' && github.context.payload.pull_request) {
|
if (github.context.payload.pull_request) {
|
||||||
|
core.info(`Action was triggered by ${github.context}: using SHA from head of source branch`)
|
||||||
const pr = github.context.payload.pull_request as EventPayloads.WebhookPayloadPullRequestPullRequest
|
const pr = github.context.payload.pull_request as EventPayloads.WebhookPayloadPullRequestPullRequest
|
||||||
return {sha: pr.head.sha, runId}
|
return {sha: pr.head.sha, runId}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue