Skip to content

Commit

Permalink
fix: #255 pipeline error (#257)
Browse files Browse the repository at this point in the history
* chore: replace zlatanpham to nphivu414 for auto assign reviewer

* fix: function to get old tag name
  • Loading branch information
duong-se authored Feb 13, 2020
1 parent e2ea03c commit 13236c4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/auto_assign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ reviewGroups:
- vuhuucuong
- phmngocnghia
- trankhacvy
- zlatanpham
- nphivu414
- danndz
useAssigneeGroups: false
35 changes: 20 additions & 15 deletions scripts/release/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env node
const spawn = require('child_process').spawnSync
const execSync = require('child_process').execSync
const Octokit = require('@octokit/rest')

const removeUnuseChar = value => {
Expand All @@ -13,7 +14,6 @@ const runCommand = (cmd, args) => {
if (stderr.length !== 0) {
throw new Error(stderr.toString().trim())
}

return stdout.toString().trim()
}

Expand All @@ -40,21 +40,26 @@ const getVersionTag = () => {
}

const getPreviousTag = ({ packageName }) => {
const tagName = runCommand('git', [
'describe',
'--always',
'--tags',
'$(git rev-list --tags)',
'|',
'grep',
packageName,
])
const tagNameArr = tagName.split('\n')
const PREVIOUS_TAG_INDEX = 1
if (tagNameArr[PREVIOUS_TAG_INDEX]) {
tagNameArr[PREVIOUS_TAG_INDEX]
try {
const tagNameWithRef = execSync(
`git for-each-ref --sort=creatordate --format '%(refname)' refs/tags | grep ${packageName} | tail -n 2`,
).toString()
const tagNameArrWithRef = tagNameWithRef.split('\n')
// tagNameArrWithRef return with format refs/tags/packageName_v1.0.2
const PREVIOUS_TAG_WITH_REF_INDEX = 0
if (tagNameArrWithRef[PREVIOUS_TAG_WITH_REF_INDEX]) {
const tagNameArr = tagNameArrWithRef[PREVIOUS_TAG_WITH_REF_INDEX].split('/')
const PREVIOUS_TAG_INDEX = 2
if (tagNameArr[PREVIOUS_TAG_INDEX]) {
// tagName return with format packageName_v1.0.2
const tagName = tagNameArr[PREVIOUS_TAG_INDEX]
return tagName
}
}
return ''
} catch (err) {
console.error(err)
}
return ''
}

const appendCommitInfo = ({ releaseNote, commitLogArr }) => {
Expand Down

0 comments on commit 13236c4

Please sign in to comment.