diff --git a/index.js b/index.js index fbbf014..34aa4ab 100644 --- a/index.js +++ b/index.js @@ -60,6 +60,10 @@ function getEnvIdFromBranch () { try { let branch = sh.exec('git name-rev HEAD --name-only').stdout + branch = branch.split('/') + + branch = branch[branch.length - 1] + return _.trimEnd(_.truncate(branch, { length: 13, omission: '' diff --git a/test/_env.js b/test/_env.js index 50e0f8b..e1636ed 100644 --- a/test/_env.js +++ b/test/_env.js @@ -6,6 +6,10 @@ const sh = require('shelljs') module.exports = function (regex) { var env = sh.exec('git name-rev HEAD --name-only').stdout + env = env.split('/') + + env = env[env.length - 1] + return env ? _.truncate(env, { length: 13, omission: ''