Improve the exec call

This commit is contained in:
koeneijkemans 2020-07-04 17:47:33 +02:00
parent e76ec1aae8
commit fbd3dd9e5c

View File

@ -1,16 +1,16 @@
const core = require('@actions/core'); const core = require('@actions/core');
const exec = require('@actions/exec'); const execlib = require('@actions/exec');
try { try {
const options ={};
let output = ''; let output = '';
options.listeners = { const options = {
stdout: (data) => { listeners: {
output += data.toString(); stdout: (data) => output += data.toString()
} }
} };
exec('git', 'branch', options)
execlib.exec('git', ['branch'], options)
core.setOutput("branchname", output); core.setOutput("branchname", output);
} catch (errror) { } catch (error) {
core.setFailed(error.message); core.setFailed(error.message);
} }