fix: use first commit if no tags are present

This commit is contained in:
Tsvetomir Tsonev 2017-07-27 16:47:33 +03:00
Родитель d44758a35e
Коммит f5acb1419c
2 изменённых файлов: 23 добавлений и 5 удалений

Просмотреть файл

@ -12,7 +12,17 @@ const until = f => array => {
return [ first, ...until(f)(array.slice(1)) ];
};
const lastTaggedRelease = () => execSync('git rev-list -1 `git describe --tags --abbrev=0 --match "v[0-9]*"`', { encoding: 'utf8' }).trim();
const lastTaggedRelease = () => {
let sha;
try {
sha = execSync('git rev-list -1 `git describe --tags --abbrev=0 --match "v[0-9]*"`', {
encoding: 'utf8'
}).trim();
} catch(e) {}
return sha;
};
module.exports = function (pluginConfig, config, cb) {
// run standard commit analysis

Просмотреть файл

@ -1,8 +1,16 @@
const execSync = require('child_process').execSync;
const lastTag = () => execSync(
'git describe --tags --match "v[0-9]*" --exclude="*dev*" --abbrev=0 origin/master',
{ encoding: 'utf8' }
).trim();
const lastTag = () => {
let sha;
try {
sha = execSync(
'git describe --tags --match "v[0-9]*" --exclude="*dev*" --abbrev=0 origin/master',
{ encoding: 'utf8' }
).trim();
} catch(e) {}
return sha;
}
module.exports = lastTag;