fix: nodejs mounted action runner should set the right current working directory
closes #79
diff --git a/src/kinds/nodejs/mount-plain.js b/src/kinds/nodejs/mount-plain.js
index 9298bf0..52eff03 100644
--- a/src/kinds/nodejs/mount-plain.js
+++ b/src/kinds/nodejs/mount-plain.js
@@ -18,6 +18,7 @@
/* eslint-disable strict */
const fs = require('fs');
+const nodePath = require('path');
// Variables will be replaced before the code is loaded
@@ -43,6 +44,8 @@
// eslint-disable-next-line no-unused-vars
function main(args) { // lgtm [js/unused-local-variable]
+ process.chdir(nodePath.dirname(path));
+
// load code again on every new invocation
const actionMain = load(path);
diff --git a/src/kinds/nodejs/mount-require.js b/src/kinds/nodejs/mount-require.js
index 6c4cbbe..273e82f 100644
--- a/src/kinds/nodejs/mount-require.js
+++ b/src/kinds/nodejs/mount-require.js
@@ -17,6 +17,8 @@
/* eslint-disable strict */
+const nodePath = require('path');
+
// Variables will be replaced before the code is loaded
// path to actual action sources
@@ -36,6 +38,7 @@
// eslint-disable-next-line no-unused-vars
function main(args) { // lgtm [js/unused-local-variable]
+ process.chdir(nodePath.dirname(path));
if (firstRun) {
const start = Date.now();