File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
.github/actions/get-node-version-from-package-lock Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,15 @@ outputs:
1111runs :
1212 using : " composite"
1313 steps :
14- - name : Install semver package
14+ - name : Install semver package in temporary location
1515 shell : bash
16- run : npm install -g semver@7.7.3
16+ run : |
17+ # Install semver in runner's temp directory to avoid polluting the repository
18+ # and interfering with project dependencies. actions/github-script can require
19+ # packages using absolute paths, so we resolve $RUNNER_TEMP path in the script.
20+ mkdir -p "$RUNNER_TEMP/github-script-deps"
21+ cd "$RUNNER_TEMP/github-script-deps"
22+ npm install semver@7.7.3 --no-package-lock --no-save
1723
1824 - name : Get Node version
1925 uses : actions/github-script@v8
2531 script : |
2632 const { resolve } = require('path');
2733 const { access, constants } = require('fs').promises;
28- const semver = require('semver');
34+ const semverPath = resolve(process.env.RUNNER_TEMP, 'github-script-deps/node_modules/semver');
35+ const semver = require(semverPath);
2936
3037 // Priority 1: Check for input override (e.g. vars.NODE_VERSION passed from caller)
3138 const envNodeVersion = process.env.OVERRIDE_NODE_VERSION;
You can’t perform that action at this time.
0 commit comments