Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: running Node.js version when using exec() #785

Merged
merged 2 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2064,7 +2064,7 @@ var require_core = __commonJS({
command_1.issueCommand("add-mask", {}, secret);
}
exports.setSecret = setSecret;
function addPath(inputPath) {
function addPath2(inputPath) {
const filePath = process.env["GITHUB_PATH"] || "";
if (filePath) {
file_command_1.issueFileCommand("PATH", inputPath);
Expand All @@ -2073,7 +2073,7 @@ var require_core = __commonJS({
}
process.env["PATH"] = `${inputPath}${path.delimiter}${process.env["PATH"]}`;
}
exports.addPath = addPath;
exports.addPath = addPath2;
function getInput2(name, options) {
const val = process.env[`INPUT_${name.replace(/ /g, "_").toUpperCase()}`] || "";
if (options && options.required && !val) {
Expand Down Expand Up @@ -10961,7 +10961,12 @@ function getFromEnv(name) {
throw new Error(`Not found '${name}' in the environment variables`);
}
async function run() {
core2.info(`Running on Node.js ${import_node_process3.default.version}`);
core2.addPath(import_node_process3.default.execPath.replace(/\/node$/u, ""));
const npmVersion = await core2.group(`Update npm to ${NPM_VERSION}`, () => updateNpm(NPM_VERSION));
await core2.group("Show runtime info", async () => {
await (0, import_exec7.exec)("npm", ["version"]);
});
await core2.group("Install user packages", async () => {
await (0, import_exec7.exec)("npm", npmArgs("ci"));
});
Expand Down
7 changes: 7 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,15 @@ function getFromEnv(name) {
}

async function run() {
core.info(`Running on Node.js ${process.version}`);
core.addPath(process.execPath.replace(/\/node$/u, ""));

const npmVersion = await core.group(`Update npm to ${NPM_VERSION}`, () => updateNpm(NPM_VERSION));

await core.group("Show runtime info", async () => {
await exec("npm", ["version"]);
});

await core.group("Install user packages", async () => {
await exec("npm", npmArgs("ci"));
});
Expand Down