mirror of
https://github.com/diligencia/semantic-branch-version.git
synced 2024-11-23 13:43:50 +08:00
31 lines
638 B
JavaScript
31 lines
638 B
JavaScript
const core = require('@actions/core');
|
|
const execlib = require('@actions/exec');
|
|
|
|
try {
|
|
getBranchName()
|
|
.then(name => {
|
|
console.log(name);
|
|
core.setOutput("branchname", name)
|
|
});
|
|
} 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);
|
|
|
|
if (output) {
|
|
console.log('Got some sweet output...' + output);
|
|
}
|
|
|
|
return output;
|
|
} |