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

fix: breaking changes are now recognized as meaningful #140

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: breaking changes are now meaningful, by footer or by exclamatio…
…n point in the type
steveluscher committed Dec 3, 2023
commit 9cbaa651ddfa95566cd7e191d54382cb91802684
11 changes: 11 additions & 0 deletions src/getCommitMeaning.test.ts
Original file line number Diff line number Diff line change
@@ -40,6 +40,17 @@ describe("getCommitMeaning", () => {
["chore(deps): release", "release"],
["chore(deps): release 1.2.3", "release"],
["chore(deps): release v1.2.3", "release"],
// Breaking changes are meaningful no matter the type of the commit.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Style] Just nitpicking here, I think the comment is explanatory from the test cases.

Suggested change
// Breaking changes are meaningful no matter the type of the commit.

["chore!: message", "meaningful"],
["docs!: message", "meaningful"],
["style!: message", "meaningful"],
["chore!: release", "meaningful"],
["chore: bump\n\nBREAKING CHANGE: breaks things", "meaningful"],
["chore: bump\n\nBREAKING-CHANGE: breaks things", "meaningful"],
["docs: bump\n\nBREAKING CHANGE: breaks things", "meaningful"],
["docs: bump\n\nBREAKING-CHANGE: breaks things", "meaningful"],
["style: bump\n\nBREAKING CHANGE: breaks things", "meaningful"],
["style: bump\n\nBREAKING-CHANGE: breaks things", "meaningful"],
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Testing] Thinking about test edge cases...

  • ! in the commit body (so not a breaking/meaningful change)
  • Footer note other than BREAKING CHANGE
  • Multiple footer notes

])("returns %j for %s", (input, expected) => {
expect(getCommitMeaning(input)).toEqual(expected);
});
5 changes: 4 additions & 1 deletion src/getCommitMeaning.ts
Original file line number Diff line number Diff line change
@@ -18,7 +18,10 @@ export function getCommitMeaning(message: string) {
type = commit.type;

// Some types are always meaningful or ignored, regardless of potentially release-like messages
if (alwaysMeaningfulTypes.has(type)) {
if (
alwaysMeaningfulTypes.has(type) ||
commit.notes.some(({ title }) => title === "BREAKING CHANGE")
) {
return "meaningful";
}