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

Ignore merge commits #81

Open
nfalco79 opened this issue Apr 29, 2020 · 1 comment
Open

Ignore merge commits #81

nfalco79 opened this issue Apr 29, 2020 · 1 comment

Comments

@nfalco79
Copy link

Our organisation have implemented a Jenkins pipeline library. This library perform a JIRA integration. We implement a check at build time to force commit message template to refer issues of type defect or story. All issue types (Epic and subtasks) other could not be referred by commit for specific reason.

So in general we have commit that respect a precise template but we are using bitbucket and to close a PR it propose:

  • use a Merge commit, commit respect the template message except the merge commit that Start with Merged pull request.... and the PR title could refers to subtask or EPIC (here the problem)
  • Fastforward, every commit message was already check
  • Squash commit let developer choose the message (they usually dont care too much and will use the proposed message that is equals to the Merge commit)

I would to be able to exclude the merge commits to gather JIRA issues. If I use ignoreCommitsIfMessageMatches that start with Merged also PR merged with squash strategy are ignore.
For our scrum merge commit are not important to determinate which issue are in a release.
The merge commit information is already there so it should be possible performa simple filter.

The best thing would be able to pass a callable (this is possible also in jenkins pipeline) to filter on Commit fields. Otherwise I have to ignore gathered issues and filter commit to get issue using the issue pattern.

@manticore-projects
Copy link

Greetings.

Looking for the same thing, I came up with:

task gitChangelogTask(type: GitChangelogTask) {
    fromRepo = file("$projectDir")
    file = new File("${projectDir}/src/site/sphinx/changelog.rst")
    fromRef = "4.0";
    //toRef = "1.1";
    templateContent ="""
************************
Changelog
************************


{{#tags}}
Version {{name}}
=============================================================

 {{#issues}}

  {{#commits}}
   {{#ifMatches messageTitle "^(?!Merge).*"}}
  * **{{messageTitle}}** - {{authorName}}
   {{/ifMatches}}
  {{/commits}}

 {{/issues}}
{{/tags}}
"""
}

The ifMatches does the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants