Update to node16 + recent versions of core and exec packages

This commit is contained in:
Michal Dorner 2022-10-13 22:05:31 +02:00
parent 0d9714ddc7
commit e54753f811
No known key found for this signature in database
GPG key ID: 7325B8B59CA1B65C
7 changed files with 52 additions and 97 deletions

View file

@ -1,21 +0,0 @@
import {exec as execImpl, ExecOptions} from '@actions/exec'
// Wraps original exec() function
// Returns exit code and whole stdout/stderr
export default async function exec(commandLine: string, args?: string[], options?: ExecOptions): Promise<ExecResult> {
options = options || {}
let stdout = ''
let stderr = ''
options.listeners = {
stdout: (data: Buffer) => (stdout += data.toString()),
stderr: (data: Buffer) => (stderr += data.toString())
}
const code = await execImpl(commandLine, args, options)
return {code, stdout, stderr}
}
export interface ExecResult {
code: number
stdout: string
stderr: string
}

View file

@ -1,11 +1,11 @@
import * as core from '@actions/core'
import exec from './exec'
import {getExecOutput} from '@actions/exec'
export async function listFiles(): Promise<string[]> {
core.startGroup('Listing all files tracked by git')
let output = ''
try {
output = (await exec('git', ['ls-files', '-z'])).stdout
output = (await getExecOutput('git', ['ls-files', '-z'])).stdout
} finally {
fixStdOutNullTermination()
core.endGroup()