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');
try {
const branchName = getBranchName();
core.setOutput("branchname", branchName);
} catch (error) {
core.setFailed(error.message);
}
async function getBranchName() {
let output = '';
const options = {
listeners: {
@ -10,7 +17,6 @@ try {
};
await execlib.exec('git', ['branch'], options);
core.setOutput("branchname", output);
} catch (error) {
core.setFailed(error.message);
return output;
}