Skip to content

Commit

Permalink
Use typed WorkflowRunEvent when parsing workflow_run payload
Browse files Browse the repository at this point in the history
Issue #603
  • Loading branch information
Jozef Izso committed Jun 8, 2025
1 parent a6b3e93 commit be2b975
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/github-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {createWriteStream} from 'fs'
import * as core from '@actions/core'
import * as github from '@actions/github'
import {GitHub} from '@actions/github/lib/utils'
import type {PullRequest} from '@octokit/webhooks-types'
import type {PullRequest, WorkflowRunEvent} from '@octokit/webhooks-types'
import * as stream from 'stream'
import {promisify} from 'util'
import got from 'got'
Expand All @@ -11,7 +11,7 @@ const asyncStream = promisify(stream.pipeline)
export function getCheckRunContext(): {sha: string; runId: number} {
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 as WorkflowRunEvent
if (!event.workflow_run) {
throw new Error("Event of type 'workflow_run' is missing 'workflow_run' field")
}
Expand Down

0 comments on commit be2b975

Please sign in to comment.