Skip to content

Commit 671f839

Browse files
committed
Use types arguments in the downloadStream event handlers
Issues #603
1 parent 57d1916 commit 671f839

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

dist/index.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/utils/github-utils.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import * as core from '@actions/core'
33
import * as github from '@actions/github'
44
import {GitHub} from '@actions/github/lib/utils'
55
import type {PullRequest, WorkflowRunEvent} from '@octokit/webhooks-types'
6+
import {IncomingMessage} from 'http'
67
import * as stream from 'stream'
78
import {promisify} from 'util'
8-
import got from 'got'
9+
import got, {Progress} from 'got'
910
const asyncStream = promisify(stream.pipeline)
1011

1112
export function getCheckRunContext(): {sha: string; runId: number} {
@@ -54,11 +55,11 @@ export async function downloadArtifact(
5455
const downloadStream = got.stream(req.url, {headers})
5556
const fileWriterStream = createWriteStream(fileName)
5657

57-
downloadStream.on('redirect', response => {
58+
downloadStream.on('redirect', (response: IncomingMessage) => {
5859
core.info(`Downloading ${response.headers.location}`)
5960
})
60-
downloadStream.on('downloadProgress', ({transferred}) => {
61-
core.info(`Progress: ${transferred} B`)
61+
downloadStream.on('downloadProgress', (progress: Progress) => {
62+
core.info(`Progress: ${progress.transferred} B`)
6263
})
6364

6465
await asyncStream(downloadStream, fileWriterStream)

0 commit comments

Comments
 (0)