mirror of
https://code.forgejo.org/pnpm/action-setup.git
synced 2025-05-20 05:14:45 +00:00
Run pnpm store prune post action
This commit is contained in:
parent
291e58ad85
commit
c8fc1974e1
3 changed files with 32 additions and 4 deletions
27
src/pnpm-store-prune/index.ts
Normal file
27
src/pnpm-store-prune/index.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { spawnSync } from 'child_process'
|
||||
import { setFailed } from '@actions/core'
|
||||
import { Inputs } from '../inputs'
|
||||
|
||||
export function pruneStore(inputs: Inputs) {
|
||||
if (inputs.runInstall.length === 0) {
|
||||
console.log('Pruning is unnecessary.')
|
||||
return
|
||||
}
|
||||
|
||||
console.log('Running pnpm store prune')
|
||||
const { error, status } = spawnSync('pnpm', ['store', 'prune'], {
|
||||
stdio: 'inherit',
|
||||
})
|
||||
|
||||
if (error) {
|
||||
setFailed(error)
|
||||
return
|
||||
}
|
||||
|
||||
if (status) {
|
||||
setFailed(`command pnpm store prune exits with code ${status}`)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
export default pruneStore
|
Loading…
Add table
Add a link
Reference in a new issue