Skip to content

Commit

Permalink
feat(conventional-changelog-conventionalcommits): add support for alp…
Browse files Browse the repository at this point in the history
…hanumeric issues (#1080)

Co-authored-by: Dan Onoshko <danon0404@gmail.com>
  • Loading branch information
FranzMoreno and dangreen committed Aug 15, 2023
1 parent 107daf2 commit f9b1897
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Expand Up @@ -35,6 +35,7 @@ setups([
},
() => {
testTools.gitDummyCommit(['feat(awesome): addresses the issue brought up in #133'])
testTools.gitDummyCommit(['feat(awesome): addresses the issue brought up in #1a2b'])
},
() => {
testTools.gitDummyCommit(['feat(awesome): fix #88'])
Expand Down Expand Up @@ -264,7 +265,7 @@ describe('conventional-changelog-conventionalcommits', () => {
}
})

it('should replace #[0-9]+ with GitHub format issue URL by default', async () => {
it('should replace #[a-z0-9]+ with issue URL by default', async () => {
preparing(2)

for await (let chunk of conventionalChangelogCore({
Expand All @@ -274,6 +275,7 @@ describe('conventional-changelog-conventionalcommits', () => {
chunk = chunk.toString()

expect(chunk).toContain('[#133](https://github.com/conventional-changelog/conventional-changelog/issues/133)')
expect(chunk).toContain('[#1a2b](https://github.com/conventional-changelog/conventional-changelog/issues/1a2b)')
}
})

Expand Down
Expand Up @@ -111,7 +111,7 @@ function getWriterOpts (config) {
if (typeof commit.subject === 'string') {
// Issue URLs.
config.issuePrefixes.join('|')
const issueRegEx = '(' + config.issuePrefixes.join('|') + ')' + '([0-9]+)'
const issueRegEx = '(' + config.issuePrefixes.join('|') + ')' + '([a-z0-9]+)'
const re = new RegExp(issueRegEx, 'g')

commit.subject = commit.subject.replace(re, (_, prefix, issue) => {
Expand Down

0 comments on commit f9b1897

Please sign in to comment.