From 82352014bcd428e272cb17c42f2ba9ef22bd1d1e Mon Sep 17 00:00:00 2001 From: Oscar Busk Date: Tue, 28 Oct 2025 00:35:57 +0100 Subject: [PATCH] Add option to disable automatic pruning of store --- README.md | 4 ++++ action.yml | 4 ++++ dist/index.js | Bin 271540 -> 271682 bytes src/inputs/index.ts | 2 ++ src/pnpm-store-prune/index.ts | 5 +++++ 5 files changed, 15 insertions(+) diff --git a/README.md b/README.md index 73212a4..87f4080 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,10 @@ If `run_install` is a YAML string representation of either an object or an array **Optional** (_type:_ `string[]`) Additional arguments after `pnpm [recursive] install`, e.g. `[--ignore-scripts, --strict-peer-dependencies]`. +#### `store_prune` + +**Optional** (_type:_ `boolean`, _default:_ `true`) Whether to run `pnpm store prune` after installation. + ### `package_json_file` **Optional** (_type:_ `string`, _default:_ `package.json`) File path to the `package.json`/[`package.yaml`](https://github.com/pnpm/pnpm/pull/1799) to read "packageManager" configuration. diff --git a/action.yml b/action.yml index e3ec7cb..92f0885 100644 --- a/action.yml +++ b/action.yml @@ -15,6 +15,10 @@ inputs: description: If specified, run `pnpm install` required: false default: 'null' + store_prune: + description: Enable store pruning after installation. Set to false to disable. + required: false + default: 'true' package_json_file: description: File path to the package.json to read "packageManager" configuration required: false diff --git a/dist/index.js b/dist/index.js index 1e543bdcb57f8165389b7321bc7730c1381b5d3e..c71dedaa3bc692f396a1e3949cf6fa2d1024959e 100644 GIT binary patch delta 128 zcmdmTQsB@jfenY5If_g2i&6uMN+-ktWM6) zE6&eJ)yv6G*H8)u=~DnH&df_!$ShV!$t+Gx%1KR`d|q0bTTe;Tx+t}zv?#B(xl6je SOPUdgnShvidzUne7AFAE@h_bK delta 35 ocmX?fN?^-LfenY5H-Bb6CEhG8(=IK;2*gZ4%)DJ%hDDtd00TJ-MgRZ+ diff --git a/src/inputs/index.ts b/src/inputs/index.ts index a9b705a..9b42f16 100644 --- a/src/inputs/index.ts +++ b/src/inputs/index.ts @@ -6,6 +6,7 @@ export interface Inputs { readonly version?: string readonly dest: string readonly runInstall: RunInstall[] + readonly storePrune: boolean readonly packageJsonFile: string readonly standalone: boolean } @@ -20,6 +21,7 @@ export const getInputs = (): Inputs => ({ version: getInput('version'), dest: parseInputPath('dest'), runInstall: parseRunInstall('run_install'), + storePrune: getBooleanInput('store_prune'), packageJsonFile: parseInputPath('package_json_file'), standalone: getBooleanInput('standalone'), }) diff --git a/src/pnpm-store-prune/index.ts b/src/pnpm-store-prune/index.ts index 1e1d6de..1c3a85f 100644 --- a/src/pnpm-store-prune/index.ts +++ b/src/pnpm-store-prune/index.ts @@ -4,6 +4,11 @@ import { Inputs } from '../inputs' import { patchPnpmEnv } from '../utils' export function pruneStore(inputs: Inputs) { + if (!inputs.storePrune) { + console.log('Store pruning is disabled, skipping pnpm store prune.') + return + } + if (inputs.runInstall.length === 0) { console.log('No install commands were run, skipping pnpm store prune, remember to run it after pnpm install if caching the store.') return