Skip to content

Commit

Permalink
fix(action): fix path to Go project in JavaScript shim
Browse files Browse the repository at this point in the history
  • Loading branch information
AtomicFS committed Oct 2, 2023
1 parent a3a0dfc commit 340213c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions dist/invoke-action.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ function main() {

// Compile Go program
console.log("Building ...");
const goBuildReturns = spawnSync('go', ['build', '-o', '../action.bin'], {
cwd: path.join(process.cwd(), 'action'),
var actionGoDir = path.join( path.dirname(process.argv[1]), '..', 'action');

const goBuildReturns = spawnSync('go', ['build', '-o', path.join(process.cwd(), 'action.bin')], {
cwd: actionGoDir,
stdio: 'inherit',
encoding: 'utf-8'
});
// Check the exit code
const statusBuild = goBuildReturns.status;
if (statusBuild !== 0) {
console.log("Building failed");
process.exit(statusBuild);
}
console.log("Building OK");

// Run Go program
console.log("Running ...");
Expand All @@ -32,6 +36,9 @@ function main() {
// Check the exit code
const statusRun = binRunReturns.status;
if (typeof statusRun === 'number') {
if (statusRun !== 0) {
console.log("ERROR: Running failed!");
}
process.exit(statusRun);
}

Expand Down

0 comments on commit 340213c

Please sign in to comment.