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

Find a better tool for CHANGELOG.md generation #2682

Open
AlekSi opened this issue May 22, 2023 · 10 comments · May be fixed by #4219
Open

Find a better tool for CHANGELOG.md generation #2682

AlekSi opened this issue May 22, 2023 · 10 comments · May be fixed by #4219
Assignees
Labels
code/chore Code maintenance improvements community Issues and PRs assigned to community members good first issue Good issues for new external contributors

Comments

@AlekSi
Copy link
Member

AlekSi commented May 22, 2023

What should be done?

Currently, we use GitHub's built-in changelog generator: https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes

We want to replace it with something that could be run locally to simplify our release process.

One good feature of the current tool is that it uses PR titles, not commits. The new tool should have that feature too.

Another feature we want to have is some customization with templates.


Once the tool is found, we should add it as a dependency (via tools.go or as a Docker image) and make it available via task changelog.

Where?

Takfile.yml

Definition of Done

task changelog works.

@AlekSi AlekSi added code/chore Code maintenance improvements not ready Issues that are not ready to be worked on; PRs that should skip CI labels May 22, 2023
@AlekSi AlekSi removed the not ready Issues that are not ready to be worked on; PRs that should skip CI label May 22, 2023
@AlekSi AlekSi assigned rumyantseva and unassigned ferretdb-bot May 22, 2023
@AlekSi AlekSi added this to the Next milestone May 22, 2023
@rumyantseva rumyantseva added the not ready Issues that are not ready to be worked on; PRs that should skip CI label May 23, 2023
@AlekSi AlekSi modified the milestones: v1.3.0, Next Jun 5, 2023
@AlekSi AlekSi modified the milestones: v1.4.0, Next Jun 19, 2023
@AlekSi AlekSi modified the milestones: v1.5.0, Next Jul 3, 2023
@AlekSi AlekSi modified the milestones: v1.6.0, Next Jul 17, 2023
@AlekSi AlekSi modified the milestones: v1.7.0, Next Jul 31, 2023
@AlekSi AlekSi modified the milestones: v1.8.0, Next Aug 14, 2023
@AlekSi AlekSi added good first issue Good issues for new external contributors and removed not ready Issues that are not ready to be worked on; PRs that should skip CI labels Aug 22, 2023
@AlekSi AlekSi removed this from the Next milestone Aug 22, 2023
@wazir-ahmed
Copy link
Contributor

@AlekSi There is a REST API to generate the release note content (markdown) without actually creating a release in GitHub. Since we already expect the developer to configure GITHUB_TOKEN in their dev env, I think we can curl this API and get the notes.

@AlekSi
Copy link
Member Author

AlekSi commented Dec 2, 2023

I think I would still prefer some other existing tool with customization

@vigneshsankariyer1234567890

Hey, if this is still a pending issue, I would love to try it out!

@AlekSi AlekSi added the community Issues and PRs assigned to community members label Mar 15, 2024
@vigneshsankariyer1234567890

@AlekSi I found this tool called git-chglog, which is written in Golang. We have an option of either running it as a Docker container, or using it as a direct dependency.

Once a template and workflow is defined, running this is simply:

git-chglog -o CHANGELOG.md

By integrating this into the Taskfile.yml, we can generate the Changelog appropriately for the latest version. Would this be a sufficient solution?

@AlekSi
Copy link
Member Author

AlekSi commented Mar 20, 2024

One good feature of the current tool is that it uses PR titles, not commits. The new tool should have that feature too.

It does not look like git-chglog uses PRs.

@vigneshsankariyer1234567890

It does use PR Titles out of the box, and is currently what they use themselves when generating their changelog between versions:

image

It's also possible to maintain the same style as the current Changelog.

@AlekSi
Copy link
Member Author

AlekSi commented Mar 20, 2024

It does use PR Titles out of the box

I think they use merge commit subject lines, not PR titles. The difference is that PR's title and labels can be edited after that PR is merged. We often do that to produce better changelog entries.

@vigneshsankariyer1234567890

@AlekSi Understood what you meant by that.

Can I clarify that in essence we need some tool that does the following:

  1. Get the list of PRs merged since last version. This can be done using a simple API call, as mentioned by @wazir-ahmed
  2. Get the list of labels from PRs
  3. Group PRs by labels that we want to use in the PR, which would be provided in some sort of config file
  4. Render new version (as provided by some template) and merge existing CHANGELOG with new version CHANGELOG

Unfortunately, there are not many out of the box solutions sufficiently allow this type of workflow, since the idea of Pull Requests are mainly relevant to only GitHub. However, majority of the solutions focus on commits specifically since it is an intrinsic part of Git itself, shared across Git-based version control platforms.

I tried the workflow above for steps 1 and 2 which are fairly easy. The latest tag and date of tag can be obtained with a git command, which can be executed using Google's GitHub wrapper or with the go-git. Subsequently, using a variant of the cURL command

curl -H "Accept: application/vnd.github+json" \
"https://api.github.com/search/issues?q=repo:FerretDB/FerretDB+is:pr+is:merged+merged:>=2023-08-28"

we can get all PRs. The great thing is the PR response from the Git endpoint has both the title of the PR and the label.

image

Subsequently, some data processing can be done to filter and group the PRs by some input labels, and finally render the new version and merge the existing CHANGELOG based on the template.

Of course, this isn't very trivial to do, but I believe that this could yield good results.

@AlekSi
Copy link
Member Author

AlekSi commented Mar 20, 2024

Merging with existing CHANGELOG (and some minor tweaks) could be done manually. The new version's changelog could be rendered to the stdout.

We would much prefer not to maintain one more tool ourselves. We might make our own, but only if no one exists already.

@vigneshsankariyer1234567890

Got it. That would be doable as well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code/chore Code maintenance improvements community Issues and PRs assigned to community members good first issue Good issues for new external contributors
Projects
Status: In progress
Development

Successfully merging a pull request may close this issue.

5 participants