From 3cec5320c953b15901aea082fbeddb59f204772f Mon Sep 17 00:00:00 2001 From: Oscar Busk Date: Tue, 28 Oct 2025 00:26:18 +0100 Subject: [PATCH] Run pruning as part of main action, not in post The post action will execute too late to actually improve any caching. By pruning directly after running pnpm install(s), we make sure the store is as clean as possible before continuing. This means any attempt to cache the pnpm store will be caching a pruned store --- action.yml | 1 - dist/index.js | Bin 271535 -> 271447 bytes src/index.ts | 6 ++---- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 831ced0..e3ec7cb 100644 --- a/action.yml +++ b/action.yml @@ -31,4 +31,3 @@ outputs: runs: using: node20 main: dist/index.js - post: dist/index.js diff --git a/dist/index.js b/dist/index.js index 425614add2445a8d0b2ac242b37b7d1ae4e14bac..c61ceab1925a34756a7c67e0306a84f2247dd391 100644 GIT binary patch delta 40 scmZ2~QsDXtfepcollL&jv07^w=;So>F}3qCF#<7&X5P-n#IjHc02NjX1^@s6 delta 138 zcmcb9LSX$#fepco>B;$d#U%&Bg<4J042dML;wH) diff --git a/src/index.ts b/src/index.ts index 7ae741b..ad0b7ad 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { setFailed, saveState, getState } from '@actions/core' +import { setFailed } from '@actions/core' import getInputs from './inputs' import installPnpm from './install-pnpm' import setOutputs from './outputs' @@ -7,13 +7,11 @@ import pruneStore from './pnpm-store-prune' async function main() { const inputs = getInputs() - const isPost = getState('is_post') - if (isPost === 'true') return pruneStore(inputs) - saveState('is_post', 'true') await installPnpm(inputs) console.log('Installation Completed!') setOutputs(inputs) pnpmInstall(inputs) + pruneStore(inputs) } main().catch(error => {