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

is there a recommended 'hello world' example for customizing the changelog? #957

Closed
iambumblehead opened this issue Dec 3, 2022 · 9 comments
Labels

Comments

@iambumblehead
Copy link

iambumblehead commented Dec 3, 2022

Hello,

Is there a small 'hello world' style example one might use to try customizing the changelog, so that the duplicates are removed?

This is one of my favorite packages and I use it in tens of projects.

A nit is the changelog nearly repeats each item in the gitlab list. Here is an example from part of a release-it changelog generated for gitlab, where the flow is: create an issue, create an MR from the issue, complete the MR and merge into the default/main branch,

* Merge branch '338-update-coverage-badge-with-new-location-remove-sinon-more-tests' into 'main' (a086eda)
* Resolve "update coverage badge with new location, remove sinon more tests" (a1b7bf7)
* Merge branch '337-remove-a-few-more-unused-dependencies-remove-sinon-from-env-tests' into 'main' (33c1e25)
* Resolve "remove a few more unused dependencies, remove sinon from env tests" (71bb12a)
* Merge branch '334-investigate-resolve-un-comment-two-tests-that-caused-test-runner-to-hang' into 'main' (54175c7)
* Resolve "investigate, resolve, un-comment two tests that caused test runner to hang" (21e4db7)

I see from the documentation that it is possible to customize the output this way,

{
  "gitlab": {
    "release": true,
    "releaseNotes": "generate-release-notes.sh ${latestVersion} ${version}"
  }
}

Any example or recommendations you might give are appreciated, thank you :)

@webpro
Copy link
Collaborator

webpro commented Jan 5, 2023

This is the default command:

git log --pretty=format:"* %s (%h)" ${from}...${to}"

So what you could do either directly in the gitlab.releaseNotes value, or deferred to in some shell script, is run something that gets you the results you need. For instance, if you want to skip the merge commits:

{
  "gitlab": {
    "release": true,
    "releaseNotes": "git log --no-merges --pretty=format:\"* %s (%h)\" ${from}...${to}",
  }
}

Does that help?

@webpro
Copy link
Collaborator

webpro commented Jan 5, 2023

This is one of my favorite packages and I use it in tens of projects.

Thank you so much, I really appreciate this!

@iambumblehead
Copy link
Author

I will try the suggestion soonish in the next week or two and report back.

@webpro webpro added the question label Jan 5, 2023
@iambumblehead
Copy link
Author

I tried simply pasting the suggested line into the package.json and the release pipeline failed with this error

"isPreRelease":false,"preReleaseId":null,"tagName":"0.17.0"}
ERROR ReferenceError: from is not defined

@webpro
Copy link
Collaborator

webpro commented Mar 9, 2023

Sorry about that. What you see below that error message is the data available in the command. Here's a better example:

{
  "gitlab": {
    "release": true,
    "releaseNotes": "git log --no-merges --pretty=format:\"* %s (%h)\" ${latestTag}...${tagName}",
  }
}

@iambumblehead
Copy link
Author

iambumblehead commented Apr 4, 2023

ERROR fatal: ambiguous argument '7.37.0...7.38.0': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Rolling back changes...

@iambumblehead
Copy link
Author

I believe this is what is needed,

git log --no-merges --pretty=format:"* %s (%h)" 7.37.0...main

@iambumblehead
Copy link
Author

@webpro this is working :)

{
  "release-it": {
    "gitlab": {
      "release": true,
      "releaseNotes": "git log --no-merges --pretty=format:\"* %s %h\" ${latestTag}...main"
    }
  }
}

@webpro
Copy link
Collaborator

webpro commented Apr 5, 2023

Thank you, much appreciated! All the trial & error at least just made it to the docs for others to enjoy :)

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

No branches or pull requests

2 participants