From 83681c63a7a2886f605472a9822e75fa9d3d219b Mon Sep 17 00:00:00 2001 From: khai96_ Date: Sat, 9 May 2020 21:50:47 +0700 Subject: [PATCH] Make logs foldable --- dist/index.js | Bin 211932 -> 212020 bytes src/install-pnpm/index.ts | 4 +++- src/pnpm-install/index.ts | 6 ++++-- src/pnpm-store-prune/index.ts | 5 +++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/dist/index.js b/dist/index.js index f63bb58fcde3aadbf6add6128e245f6f20ecf769..d3c58f06fd8764933609164d19e197ebfefc07a3 100644 GIT binary patch delta 218 zcmccfooCAro()Sr^W^9imn0UIxEJM@7EE6MS&CUtPjB+c&n0F#dZ~FSU||hS>&!Hb zRL$xfz4FAOyv)3GAji5WwWPEtuNEkih9uLR^<{h37sjQhgD98Pu}oZYVz67CAyhu8mXGqIeNvZC2onCIjJc? zu60prNoi4DEl@5EMXtI0%l7gwj7v|6BN?Tk6jYj*mzkHYq*FZIYClu#_9gq7p8HFJ hl$0o>+9sAKW|k-v>!qZoC6?xtXyk3b&CeXE0|18*KAHdk diff --git a/src/install-pnpm/index.ts b/src/install-pnpm/index.ts index da85a61..6952ead 100644 --- a/src/install-pnpm/index.ts +++ b/src/install-pnpm/index.ts @@ -1,11 +1,13 @@ -import { setFailed } from '@actions/core' +import { setFailed, startGroup, endGroup } from '@actions/core' import { Inputs } from '../inputs' import runSelfInstaller from './run' export { runSelfInstaller } export async function install(inputs: Inputs) { + startGroup('Running self-installer...') const status = await runSelfInstaller(inputs) + endGroup() if (status) { return setFailed(`Something does wrong, self-installer exits with code ${status}`) } diff --git a/src/pnpm-install/index.ts b/src/pnpm-install/index.ts index 5ea479b..821e114 100644 --- a/src/pnpm-install/index.ts +++ b/src/pnpm-install/index.ts @@ -1,5 +1,5 @@ import { spawnSync } from 'child_process' -import { setFailed } from '@actions/core' +import { setFailed, startGroup, endGroup } from '@actions/core' import { Inputs } from '../inputs' import { patchPnpmEnv } from '../utils' @@ -12,7 +12,7 @@ export function runPnpmInstall(inputs: Inputs) { if (options.args) args.push(...options.args) const cmdStr = ['pnpm', ...args].join(' ') - console.log('Running', cmdStr) + startGroup(`Running ${cmdStr}...`) const { error, status } = spawnSync('pnpm', args, { stdio: 'inherit', @@ -21,6 +21,8 @@ export function runPnpmInstall(inputs: Inputs) { env, }) + endGroup() + if (error) { setFailed(error) continue diff --git a/src/pnpm-store-prune/index.ts b/src/pnpm-store-prune/index.ts index 9ff0887..792552a 100644 --- a/src/pnpm-store-prune/index.ts +++ b/src/pnpm-store-prune/index.ts @@ -1,5 +1,5 @@ import { spawnSync } from 'child_process' -import { warning } from '@actions/core' +import { warning, startGroup, endGroup } from '@actions/core' import { Inputs } from '../inputs' import { patchPnpmEnv } from '../utils' @@ -9,12 +9,13 @@ export function pruneStore(inputs: Inputs) { return } - console.log('Running pnpm store prune') + startGroup('Running pnpm store prune...') const { error, status } = spawnSync('pnpm', ['store', 'prune'], { stdio: 'inherit', shell: true, env: patchPnpmEnv(inputs) }) + endGroup() if (error) { warning(error)