mirror of
https://github.com/diligencia/semantic-branch-version.git
synced 2024-11-23 13:33:51 +08:00
23 lines
494 B
JavaScript
23 lines
494 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()
|
|
},
|
|
cwd = './'
|
|
};
|
|
|
|
await execlib.exec('git', ['branch'], options);
|
|
|
|
return output;
|
|
} |