Comments (5)
Provided custom values for the suggested arguments as shown below:
{
mergePattern: /^Merge branch '(.*)' into '(.*)'$/,
mergeCorrespondence: ['source', 'destination'],
}
With that I received the following commit object for the merge commit:
{ type: null,
scope: null,
subject: null,
source: 'docs/readme',
destination: 'master',
merge: 'Merge branch \'docs/readme\' into \'master\'',
header: 'Docs/readme',
body: 'See merge request !1',
footer: null,
notes: [],
references: [],
mentions: [],
revert: null }
So it's now successfully detecting the merge header.
That still doesn't give me access to the merge request ID.
Therefore I extended the custom options:
{
mergePattern: /^Merge branch '(.*)' into '(.*)'$/,
mergeCorrespondence: ['source', 'destination'],
issuePrefixes: ['#', '!'],
referenceActions: [ 'close', 'closes', 'closed', 'fix', 'fixes', 'fixed', 'resolve', 'resolves', 'resolved', 'See merge request' ]
By specifying the issuePrefixes
and referenceActions
I get the following:
{ type: null,
scope: null,
subject: null,
source: 'docs/readme',
destination: 'master',
merge: 'Merge branch \'docs/readme\' into \'master\'',
header: 'Docs/readme',
body: null,
footer: 'See merge request !1',
notes: [],
references:
[ { action: 'See merge request',
owner: null,
repository: null,
issue: '1',
raw: '!1',
prefix: '!' } ],
mentions: [],
revert: null }
So as you noted, that gives me access to the ID number, and I can tell it's a merge request because of the prefix.
Oddly, now, if I just set the issuePrefixes
and referenceActions
I get the same reference object. It doesn't seem I need to override mergePattern
and mergeCorrespondence
. Not sure why I wasn't able to get the merge request ID as noted in my earlier comment.
I must have made a mistake somewhere then.
I'll be able to move forward with my own project now that I can get at the merge ID.
Thank you for your help with tackling my issue.
from conventional-commits-parser.
what's your referenceActions
?
from conventional-commits-parser.
The commit object in my initial comment is based on calling the parser without any custom configuration.
I then modified the issuePrefix
configuration property in an attempt to get the merge request ID, to no avail.
I then, based on your suggestion, modified the referenceActions
property, with and without modifying issuePrefix
, and still not able to get the merge request ID. (I set referenceActions
to See merge request
.)
from conventional-commits-parser.
Why don't you use mergePattern
and mergeCorrespondence
?
If you treat it as a reference it should still work. Can you set a break point at https://github.com/conventional-changelog/conventional-commits-parser/blob/master/lib/parser.js#L99-L127 and see what you've got?
from conventional-commits-parser.
@stevemao thanks for the pointer! I'll give that a try next.
I haven't had an opportunity to look into mergePattern
yet while I was investigating this issue: conventional-changelog/releaser-tools#22
from conventional-commits-parser.
Related Issues (20)
- Change header pattern so that it can match any number of parts
- Support prefixes for issues HOT 5
- expose owner :D
- expose lib/parser as a sync function
- trim all parts
- Should preserve newlines in a part HOT 1
- change issuePrefixes to referencePrefixes HOT 1
- expose msg.reference.referencePrefix
- noteKeywords should be case insensitive
- Using a regex for issuePrefixes HOT 21
- any noteKeywords must be at the beginning of a sentence.
- mentions `@` support
- referencing a commit in parenthesis results in a parsing error HOT 3
- Apparently "important changes" may have more than one paragraph HOT 1
- Support other formats of references HOT 1
- CLI
- make `headerPattern` more flexible
- regex tests are not useful
- Tool to prompt user for commit HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conventional-commits-parser.