mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 22:37:09 +01:00
Use typed WorkflowRunEvent when parsing workflow_run payload
Issue #603
This commit is contained in:
parent
f078ba5e08
commit
57d1916a57
1 changed files with 2 additions and 2 deletions
|
|
@ -2,7 +2,7 @@ import {createWriteStream} from 'fs'
|
||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as github from '@actions/github'
|
import * as github from '@actions/github'
|
||||||
import {GitHub} from '@actions/github/lib/utils'
|
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 * as stream from 'stream'
|
||||||
import {promisify} from 'util'
|
import {promisify} from 'util'
|
||||||
import got from 'got'
|
import got from 'got'
|
||||||
|
|
@ -11,7 +11,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')
|
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) {
|
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")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue