Skip to content

Commit

Permalink
🐛 Fix mis-recognizing character '*' as a gitmoji
Browse files Browse the repository at this point in the history
  • Loading branch information
momocow committed Jul 30, 2024
1 parent 51a32f7 commit 108cdae
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 31 deletions.
5 changes: 3 additions & 2 deletions lib/helper/parse-commits.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const issueRegex = require('issue-regex')
const emojiRegex = require('emoji-regex/text')
const emojiRegex = require('emoji-regex')
const escapeStringRegex = require('escape-string-regexp')
const { emojify } = require('node-emoji')
const { gitmojis } = require('gitmojis')

Expand Down Expand Up @@ -48,7 +49,7 @@ function parseGitmoji ({ subject = '', message = '', body = '' } = {}, issues =

const gitmoji = matched[0]
const semver = gitmojis.find(matchEmoji(gitmoji))?.semver || 'other'
subject = subject.replace(new RegExp('^' + gitmoji), '')
subject = subject.replace(new RegExp('^' + escapeStringRegex(gitmoji)), '')

return { subject, message: subject + '\n\n' + body, gitmoji, semver }
}
Expand Down
75 changes: 48 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"dependencies": {
"dateformat": "^3.0.3",
"debug": "^4.3.2",
"emoji-regex": "^9.2.2",
"emoji-regex": "^10.3.0",
"escape-string-regexp": "^4.0.0",
"git-url-parse": "^13.0.0",
"gitmojis": "^3.13.4",
"handlebars": "^4.7.6",
Expand All @@ -66,4 +67,4 @@
"lib",
"index.js"
]
}
}

0 comments on commit 108cdae

Please sign in to comment.