tool-cache: make extract functions quiet by default and more verbose if core.isDebug is set (#206)

* tool-cache: make unzip and 7z extract quiet by default

This avoids spamming the log when unzipping large archives.

* tool-cache: make tar, unzip and 7z verbose when `core.isDebug`

Make the extract function print the list of extracted file if
the action is run in debug mode.
This commit is contained in:
Arthur Baars
2020-04-29 17:33:01 +02:00
committed by GitHub
parent 4e734dc4c1
commit 57d20b4db4
2 changed files with 12 additions and 3 deletions

View File

@@ -144,9 +144,10 @@ export async function extract7z(
process.chdir(dest)
if (_7zPath) {
try {
const logLevel = core.isDebug() ? '-bb1' : '-bb0'
const args: string[] = [
'x', // eXtract files with full paths
'-bb1', // -bb[0-3] : set output log level
logLevel, // -bb[0-3] : set output log level
'-bd', // disable progress indicator
'-sccUTF-8', // set charset for for console input/output
file
@@ -227,6 +228,10 @@ export async function extractTar(
// Initialize args
const args = [flags]
if (core.isDebug() && !flags.includes('v')) {
args.push('-v')
}
let destArg = dest
let fileArg = file
if (IS_WINDOWS && isGnuTar) {
@@ -295,7 +300,11 @@ async function extractZipWin(file: string, dest: string): Promise<void> {
async function extractZipNix(file: string, dest: string): Promise<void> {
const unzipPath = await io.which('unzip', true)
await exec(`"${unzipPath}"`, [file], {cwd: dest})
const args = [file]
if (!core.isDebug()) {
args.unshift('-q')
}
await exec(`"${unzipPath}"`, args, {cwd: dest})
}
/**