Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 allow matches with reserved regex characters #84

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .releaserc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ const fs = require('fs')
const tplFile = path.resolve(__dirname, 'build/release-notes.hbs')

module.exports = {
branches: [
"main",
],
plugins: [
[
'semantic-release-gitmoji',
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# semantic-release-gitmoji
[![Build Status](https://app.travis-ci.com/momocow/semantic-release-gitmoji.svg?branch=master)](https://app.travis-ci.com/momocow/semantic-release-gitmoji)
[![Test Status](https://github.com/momocow/semantic-release-gitmoji/actions/workflows/test.yaml/badge.svg?branch=main)](https://github.com/momocow/semantic-release-gitmoji/actions/workflows/test.yaml)
[![Release Status](https://github.com/momocow/semantic-release-gitmoji/actions/workflows/release.yaml/badge.svg?branch=main)](https://github.com/momocow/semantic-release-gitmoji/actions/workflows/release.yaml)
[![npm](https://img.shields.io/npm/v/semantic-release-gitmoji.svg)](https://www.npmjs.com/semantic-release-gitmoji)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Gitmoji](https://img.shields.io/badge/gitmoji-%20😜%20😍-FFDD67.svg?style=flat-square)](https://gitmoji.carloscuesta.me/)
Expand Down
7 changes: 5 additions & 2 deletions lib/helper/parse-commits.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ function parseGitmoji ({ subject = '', message = '', body = '' } = {}, issues =
const matched = emojiRegex().exec(subject)
if (!matched || matched.index !== 0) return null

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

// lightly escape to issue where commits starts with a special regex char https://github.com/momocow/semantic-release-gitmoji/issues/76
const gitmojiEscaped = gitmoji.replace(/[/\-\\^$*+?.()|[\]{}]/g, '\\$&')
subject = subject.replace(new RegExp('^' + gitmojiEscaped), '')

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

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

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "semantic-release-gitmoji",
"version": "1.6.3",
"version": "1.6.5",
"description": "Different from conventional changelog, Gitmoji commits are used to determine a release type and generate release notes.",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -60,7 +60,7 @@
"node-emoji": "^1.11.0"
},
"peerDependencies": {
"semantic-release": "<22"
"semantic-release": "<23"
},
"files": [
"lib",
Expand Down