await should be in a function

This commit is contained in:
koeneijkemans 2020-07-04 18:45:30 +02:00
parent e035f0c08a
commit 96d1be5d2b

View File

@ -2,6 +2,13 @@ const core = require('@actions/core');
const execlib = require('@actions/exec'); const execlib = require('@actions/exec');
try { try {
const branchName = getBranchName();
core.setOutput("branchname", branchName);
} catch (error) {
core.setFailed(error.message);
}
async function getBranchName() {
let output = ''; let output = '';
const options = { const options = {
listeners: { listeners: {
@ -10,7 +17,6 @@ try {
}; };
await execlib.exec('git', ['branch'], options); await execlib.exec('git', ['branch'], options);
core.setOutput("branchname", output);
} catch (error) { return output;
core.setFailed(error.message);
} }