mirror of
https://github.com/xuexb/github-bot.git
synced 2026-01-18 13:56:38 +00:00
fix: get tag list
This commit is contained in:
parent
ad316f327e
commit
23bfb7a6c4
12
src/utils.js
12
src/utils.js
@ -107,12 +107,18 @@ const utils = {
|
||||
/**
|
||||
* 获取本地 git 目录的 tag 列表
|
||||
*
|
||||
* @param {string} options.dir git 目录
|
||||
* @param {Object} options 配置
|
||||
* @param {string} options.dir git 目录
|
||||
*
|
||||
* @return {Array}
|
||||
*/
|
||||
getTags({dir}) {
|
||||
return execSync(`cd ${dir} && git tag -l`).toString().split(/\n+/).filter(tag => !!tag).reverse();
|
||||
getTags(options) {
|
||||
const shell = [
|
||||
'cd {dir}',
|
||||
'git describe --tags `git rev-list --tags --abbrev=0` --abbrev=0 | uniq'
|
||||
].join(' && ');
|
||||
|
||||
return execSync(format(shell, options)).toString().split(/\n+/).filter(tag => !!tag);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user