-
Notifications
You must be signed in to change notification settings - Fork 3
/
action.js
executable file
·32 lines (28 loc) · 882 Bytes
/
action.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const core = require('@actions/core');
function run() {
try {
// This is just a thin wrapper around bash
const script = require('path').resolve(__dirname, 'script.sh');
var child = require('child_process').execFile(script);
// child.stderr.on('data', (data) => {
// console.warn(data.toString());
// });
var all_output = "";
child.stdout.on('data', (data) => {
all_output += data.toString();
process.stdout.write(data.toString());
});
child.stderr.on('data', (data) => {
all_output += data.toString();
});
child.on('close', (code) => {
console.log(`child process exited with code ${code}`);
if (code != 0) console.error("Error detected. All stdout and stderr outputs:\n" + all_output + "\n");
process.exit(code);
});
}
catch (error) {
core.setFailed(error.message);
}
}
run()