1+ import { inspect } from "util" ;
12import { isFullGitSha } from "../../shared/src/git.js" ;
23import { PER_PAGE_MAX } from "../../shared/src/github.js" ;
34import { CoreLogger } from "./core-logger.js" ;
@@ -22,7 +23,15 @@ export async function extractInputs(github, context, core) {
2223 core . info ( "extractInputs()" ) ;
2324 core . info ( ` eventName: ${ context . eventName } ` ) ;
2425 core . info ( ` payload.action: ${ context . payload . action } ` ) ;
25- core . info ( ` payload.workflow_run.event: ${ context . payload . workflow_run ?. event || "undefined" } ` ) ;
26+
27+ let workflowRunEvent = "undefined" ;
28+ if ( context . eventName === "workflow_run" ) {
29+ const payload = /** @type {import("@octokit/webhooks-types").WorkflowRunEvent } */ (
30+ context . payload
31+ ) ;
32+ workflowRunEvent = payload . workflow_run ?. event ;
33+ }
34+ core . info ( ` payload.workflow_run.event: ${ workflowRunEvent } ` ) ;
2635
2736 // Log full context when debug is enabled. Most workflows should be idempotent and can be re-run
2837 // with debug enabled to replay the previous context.
@@ -164,7 +173,7 @@ export async function extractInputs(github, context, core) {
164173 core . info ( `Error: ${ error instanceof Error ? error . message : "unknown" } ` ) ;
165174
166175 // Long message only in debug
167- core . debug ( `Error: ${ error } ` ) ;
176+ core . debug ( `Error: ${ inspect ( error ) } ` ) ;
168177 }
169178
170179 if ( pullRequests . length === 0 ) {
@@ -270,10 +279,10 @@ export async function extractInputs(github, context, core) {
270279 run_id : payload . workflow_run . id ,
271280 } ;
272281 } else if ( context . eventName === "check_run" ) {
273- let checkRun = context . payload . check_run ;
274282 const payload = /** @type {import("@octokit/webhooks-types").CheckRunEvent } */ (
275283 context . payload
276284 ) ;
285+ const checkRun = payload . check_run ;
277286 const repositoryInfo = getRepositoryInfo ( payload . repository ) ;
278287 inputs = {
279288 owner : repositoryInfo . owner ,
0 commit comments