-
Notifications
You must be signed in to change notification settings - Fork 799
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
Dealing with Azure DevOps Squash Merge prefixes #690
Comments
Further link to discussion about this topic |
This is not only related to Azure. Also GitHub and Bitbucket add these commit messages to a PR. This leads standard-version to only increase the patch version, even if the PR contains a feature or breaking change. |
Same issue here |
Same here. For now, my solution is to block any kind of merge strategy that creates a merge commit. |
Using the right headerPattern that can correctly parse either the merge message or the commit message I was able to workaround the issue: echo "Merged PR 6359: fix(credit): delete split schedule" | npx conventional-commits-parser --header-pattern "(?:\\(Merged PR \\d+: \\))?([a-zA-Z]+)(?:\\(([\\w$\\.\\-*\\s]*)\\))?\\!?:(.*)" --header-correspondence 'type, scope, subject' [
{
"type": "fix",
"scope": "credit",
"subject": " delete split schedule",
"merge": null,
"header": "Merged PR 6359: fix(credit): delete split schedule even if the contract was already closed - PREPROD",
"body": null,
"footer": null,
"notes": [],
"references": [],
"mentions": [],
"revert": null
}
] So here is my changelog.config,json file: {
"parserOpts": {
"headerPattern": "(?:\\(Merged PR \\d+: \\))?([a-zA-Z]+)(?:\\(([\\w$\\.\\-*\\s]*)\\))?\\!?:(.*)",
"headerCorrespondence": ["type", "scope", "subject"]
}
} |
@GoMino do you mind posting a complete example? How do you set up |
Here is the command I use to specify my config: npx conventional-changelog --config changelog.config.json --context changelog.context.json -i CHANGELOG.md -s changelog.config.json {
"options": {
"preset": {
"name": "conventionalcommits",
"issuePrefixes": ["XX-", "XRUN-", "XRAY-"],
"issueUrlFormat": "https://****/browse/{{prefix}}{{id}}",
"commitUrlFormat": "{{host}}/{{owner}}/{{repository}}/commit/{{hash}}",
"compareUrlFormat": "{{host}}/{{owner}}/{{repository}}/branchCompare?baseVersion=GT{{previousTag}}&targetVersion=GT{{currentTag}}&_a=commits",
"types": [
{ "type": "feat", "section": "Features" },
{ "type": "feature", "section": "Features" },
{ "type": "fix", "section": "Bug Fixes" },
{ "type": "hotfix", "section": "Bug Fixes" },
{ "type": "perf", "section": "Performance Improvements" },
{ "type": "revert", "section": "Reverts" },
{ "type": "docs", "section": "Documentation", "hidden": false },
{ "type": "style", "section": "Styles", "hidden": true },
{ "type": "chore", "section": "Miscellaneous Chores", "hidden": false },
{ "type": "refactor", "section": "Refactoring", "hidden": false },
{ "type": "rework", "section": "Refactoring", "hidden": false },
{ "type": "test", "section": "Tests", "hidden": true },
{ "type": "build", "section": "Build System", "hidden": true },
{ "type": "ci", "section": "Continuous Integration", "hidden": true }
]
}
},
"writerOpts": {
"reverse": true,
"commitsSort": ["scope", "subject", "committerDate"]
},
"parserOpts": {
"headerPattern": "(?:\\(Merged PR \\d+: \\))?([a-zA-Z]+)(?:\\(([\\w$\\.\\-*\\s\\,]*)\\))?\\!?\\s?[\\:\\-](.*)",
"headerCorrespondence": ["type", "scope", "subject"]
}
} changelog.context.json {
"commit": "commit",
"host": "*********",
"owner": "*********",
"repository": "*********",
"version": "x.y.z"
}
|
Can we add support for bitbucket ? In bitbucket also when we try to merge PR it add this message as default. |
Seeing as standard-version is no longer supported I was able to implement a solution using the Regex from @GoMino and absolute-version/commit-and-tag-version. Here's the .versionrc configuration I'm using:
This can be run using:
|
@mholttech I've also implemented similar however it seems to break the semantic version bumping.
|
yes we observed the same. It looks like that the config is not propagated to the bumper and is still uses the default without the optional "Merged PR ...". The patch update then is the default when bumping and not finding a feat. |
That's my findings aswell, looks like #821 was raised for it here. |
In addition to the version bumping issue mentioned above, commits using the breaking changes syntax (type!: subject) will not receive a major version increase unless you also include the following in your "parserOpts" config:
|
I´m having the same issue but using the cz-conventional-changelog package with lerna and NX |
When using Azure DevOps' squash merge feature, it adds a prefix of "Merged PR {nnn}: " to the PR title which itself it taken from the title of the first commit message associated with the request. This of course breaks standard-version and requires developers to remember to click "Customize merge message" and delete the offending prefix.
Is there any way to customize standard-version to mitigate this issue to reduce the friction?
For example, if a regex of "Merged PR \{[0-9]+\}: " could be specified as an optionally occurring prefix to any conventional commits, this would prevent accidental merges without properly fixing up the commit title.
Related Azure DevOps issue
The text was updated successfully, but these errors were encountered: