semantic-branch-version/index.js
2020-07-04 19:03:59 +02:00

22 lines
474 B
JavaScript

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: {
stdout: (data) => output += data.toString()
}
};
await execlib.exec('git', ['branch'], options);
return output;
}