Giter VIP home page Giter VIP logo

Comments (5)

hutson avatar hutson commented on May 18, 2024 1

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.

stevemao avatar stevemao commented on May 18, 2024

what's your referenceActions?

from conventional-commits-parser.

hutson avatar hutson commented on May 18, 2024

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.

stevemao avatar stevemao commented on May 18, 2024

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.

hutson avatar hutson commented on May 18, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.