diff --git a/index.js b/index.js index 4161914..12be7bf 100644 --- a/index.js +++ b/index.js @@ -27,12 +27,14 @@ async function getBranchName() { } }; - await execlib.exec('git', ['branch'], options); + await execlib.exec('git', ['branch', '--show-current'], options); return output; } function extractVersion(branch) { - const regexp = /^([0-9]\.[0-9]\.[0-9])|([0-9]\.[0-9])|([0-9])$/; - return branch.match(regexp); + const regexp = /([0-9]\.[0-9]\.[0-9])|([0-9]\.[0-9])|([0-9])/g; + const matches = branch.match(regexp); + + return matches ? matches.shift() : null; } \ No newline at end of file