mirror of
				https://github.com/pnpm/action-setup.git
				synced 2025-10-31 01:12:08 +08:00 
			
		
		
		
	Make logs foldable
This commit is contained in:
		
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -1,11 +1,13 @@ | |||||||
| import { setFailed } from '@actions/core' | import { setFailed, startGroup, endGroup } from '@actions/core' | ||||||
| import { Inputs } from '../inputs' | import { Inputs } from '../inputs' | ||||||
| import runSelfInstaller from './run' | import runSelfInstaller from './run' | ||||||
|  |  | ||||||
| export { runSelfInstaller } | export { runSelfInstaller } | ||||||
|  |  | ||||||
| export async function install(inputs: Inputs) { | export async function install(inputs: Inputs) { | ||||||
|  |   startGroup('Running self-installer...') | ||||||
|   const status = await runSelfInstaller(inputs) |   const status = await runSelfInstaller(inputs) | ||||||
|  |   endGroup() | ||||||
|   if (status) { |   if (status) { | ||||||
|     return setFailed(`Something does wrong, self-installer exits with code ${status}`) |     return setFailed(`Something does wrong, self-installer exits with code ${status}`) | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| import { spawnSync } from 'child_process' | import { spawnSync } from 'child_process' | ||||||
| import { setFailed } from '@actions/core' | import { setFailed, startGroup, endGroup } from '@actions/core' | ||||||
| import { Inputs } from '../inputs' | import { Inputs } from '../inputs' | ||||||
| import { patchPnpmEnv } from '../utils' | import { patchPnpmEnv } from '../utils' | ||||||
|  |  | ||||||
| @@ -12,7 +12,7 @@ export function runPnpmInstall(inputs: Inputs) { | |||||||
|     if (options.args) args.push(...options.args) |     if (options.args) args.push(...options.args) | ||||||
|  |  | ||||||
|     const cmdStr = ['pnpm', ...args].join(' ') |     const cmdStr = ['pnpm', ...args].join(' ') | ||||||
|     console.log('Running', cmdStr) |     startGroup(`Running ${cmdStr}...`) | ||||||
|  |  | ||||||
|     const { error, status } = spawnSync('pnpm', args, { |     const { error, status } = spawnSync('pnpm', args, { | ||||||
|       stdio: 'inherit', |       stdio: 'inherit', | ||||||
| @@ -21,6 +21,8 @@ export function runPnpmInstall(inputs: Inputs) { | |||||||
|       env, |       env, | ||||||
|     }) |     }) | ||||||
|  |  | ||||||
|  |     endGroup() | ||||||
|  |  | ||||||
|     if (error) { |     if (error) { | ||||||
|       setFailed(error) |       setFailed(error) | ||||||
|       continue |       continue | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| import { spawnSync } from 'child_process' | import { spawnSync } from 'child_process' | ||||||
| import { warning } from '@actions/core' | import { warning, startGroup, endGroup } from '@actions/core' | ||||||
| import { Inputs } from '../inputs' | import { Inputs } from '../inputs' | ||||||
| import { patchPnpmEnv } from '../utils' | import { patchPnpmEnv } from '../utils' | ||||||
|  |  | ||||||
| @@ -9,12 +9,13 @@ export function pruneStore(inputs: Inputs) { | |||||||
|     return |     return | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   console.log('Running pnpm store prune') |   startGroup('Running pnpm store prune...') | ||||||
|   const { error, status } = spawnSync('pnpm', ['store', 'prune'], { |   const { error, status } = spawnSync('pnpm', ['store', 'prune'], { | ||||||
|     stdio: 'inherit', |     stdio: 'inherit', | ||||||
|     shell: true, |     shell: true, | ||||||
|     env: patchPnpmEnv(inputs) |     env: patchPnpmEnv(inputs) | ||||||
|   }) |   }) | ||||||
|  |   endGroup() | ||||||
|  |  | ||||||
|   if (error) { |   if (error) { | ||||||
|     warning(error) |     warning(error) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user