mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 14:57:09 +01:00
22 lines
693 B
TypeScript
22 lines
693 B
TypeScript
import * as core from '@actions/core'
|
|
import {getExecOutput} from '@actions/exec'
|
|
|
|
export async function listFiles(): Promise<string[]> {
|
|
core.startGroup('Listing all files tracked by git')
|
|
let output = ''
|
|
try {
|
|
output = (await getExecOutput('git', ['ls-files', '-z'])).stdout
|
|
} finally {
|
|
fixStdOutNullTermination()
|
|
core.endGroup()
|
|
}
|
|
|
|
return output.split('\u0000').filter(s => s.length > 0)
|
|
}
|
|
|
|
function fixStdOutNullTermination(): void {
|
|
// Previous command uses NULL as delimiters and output is printed to stdout.
|
|
// We have to make sure next thing written to stdout will start on new line.
|
|
// Otherwise things like ::set-output wouldn't work.
|
|
core.info('')
|
|
}
|