Some checks failed
Test Action / Test with default inputs (macos-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with default inputs (ubuntu-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with default inputs (windows-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with explicit inputs (macos-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with explicit inputs (ubuntu-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with explicit inputs (windows-latest, 4.11.1) (push) Has been cancelled
Test Action / Test with run_install (array, macos-latest) (push) Has been cancelled
Test Action / Test with run_install (empty object, macos-latest) (push) Has been cancelled
Test Action / Test with run_install (global, macos-latest) (push) Has been cancelled
Test Action / Test with run_install (null, macos-latest) (push) Has been cancelled
Test Action / Test with run_install (recursive, macos-latest) (push) Has been cancelled
Test Action / Test with run_install (array, ubuntu-latest) (push) Has been cancelled
Test Action / Test with run_install (empty object, ubuntu-latest) (push) Has been cancelled
Test Action / Test with run_install (global, ubuntu-latest) (push) Has been cancelled
Test Action / Test with run_install (null, ubuntu-latest) (push) Has been cancelled
Test Action / Test with run_install (recursive, ubuntu-latest) (push) Has been cancelled
Test Action / Test with run_install (array, windows-latest) (push) Has been cancelled
Test Action / Test with run_install (empty object, windows-latest) (push) Has been cancelled
Test Action / Test with run_install (global, windows-latest) (push) Has been cancelled
Test Action / Test with run_install (null, windows-latest) (push) Has been cancelled
Test Action / Test with run_install (recursive, windows-latest) (push) Has been cancelled
32 lines
701 B
TypeScript
32 lines
701 B
TypeScript
import { warning, startGroup, endGroup } from '@actions/core'
|
|
import { spawnSync } from 'child_process'
|
|
import { Inputs } from '../inputs'
|
|
import { patchPnpmEnv } from '../utils'
|
|
|
|
export function pruneStore(inputs: Inputs) {
|
|
if (inputs.runInstall.length === 0) {
|
|
console.log('Pruning is unnecessary.')
|
|
return
|
|
}
|
|
|
|
startGroup('Running pnpm store prune...')
|
|
const { error, status } = spawnSync('pnpm', ['store', 'prune'], {
|
|
stdio: 'inherit',
|
|
shell: true,
|
|
env: patchPnpmEnv(inputs),
|
|
})
|
|
endGroup()
|
|
|
|
if (error) {
|
|
warning(error)
|
|
return
|
|
}
|
|
|
|
if (status) {
|
|
warning(`command pnpm store prune exits with code ${status}`)
|
|
return
|
|
}
|
|
}
|
|
|
|
export default pruneStore
|