GitTools / GitReleaseManager

Tool for creating and exporting releases for software applications hosted on GitHub
https://gittools.github.io/GitReleaseManager/docs/
MIT License
298 stars 39 forks source link

(#89) Add ability to populate release notes with information about contributors #541

Open Jericho opened 8 months ago

Jericho commented 8 months ago

Properly attribute each issue / PR which is part of a release.

Resolves #89

Jericho commented 7 months ago

@gep13 please review at your convenience but do not merge yet. I just rebased your recent changes and I am now investigating how to implement my new feature in GitLat.

UPDATE: I converted to draft to make sure this PR is not merged.

Jericho commented 7 months ago

I solved all the remaining issues. This logic is compatible with multiple issues/PRs being associated with a given issue/PRs and also the GetLinkedIssues method has been implemented for GitLab.

Jericho commented 7 months ago

@gep13 in case I wasn't clear: this PR is ready for review.

Jericho commented 6 months ago

In case anybody is interested to try this new feature, you can replace

#tool nuget:?package=GitReleaseManager&version=0.16.0 with #tool nuget:https://f.feedz.io/jericho/jericho/nuget/?package=GitReleaseManager&version=0.17.0-collaborators0003

in your cake script and you'll be able to generate release notes similar to this: https://github.com/Jericho/ZoomNet/releases/tag/0.71.0

gep13 commented 4 months ago

@Jericho please accept my apologies for the radio silence on this PR! Simply put, I haven't had any time to even think about looking at this. I am hoping to review this in the coming days, and will provide some feedback (if there is any).

Thanks again for your help with this!

Jericho commented 4 months ago

No apologies necessary. I'm just glad to be contributing.

gep13 commented 3 months ago

@Jericho apologies again! I haven't had a chance to look at this yet, and looks like I am going to have to do an immediate release to fix the issue with creating releases as a result of a required change upstream to Octokit.

Jericho commented 3 months ago

Rebased to pull in yesterday's commits.

gep13 commented 1 month ago

@Jericho is there something "special" that has to be done to get the generated release notes to contain the contributors?

The reason that I ask is that we have an upcoming release of Chocolatey CLI, and I thought I would take this for a spin to see it in action, however, I am not seeing anything other than the normal output in the generated release notes. I can see that in code, the contributors for the issues are populated in the GetContributors call, but the template changes don't seem to be taking effect.

Jericho commented 1 month ago

If you are referencing my beta package #tool nuget:https://f.feedz.io/jericho/jericho/nuget/?package=GitReleaseManager&version=0.17.0-collaborators0003, nothing special that you need to do. The result will be release notes similar to the notes on this project: https://github.com/Jericho/StrongGrid/releases (please note, I started using my beta package in late December 2023 if I remember correctly, so only consider releases since January 2024).

If you are running GRM from source in Visual Studio, make sure you "rebuild" the whole project. It seems that changes to templates are not effective until you rebuild. This issue has caused me grief on several occasions where I modified the template but my changes were no reflected in the resulting release notes. My guess is that this problem is due to Visual Studio not automatically detecting changes to .sbn files. Anyway, long story short: make sure you rebuild the project and you should be good to go.

gep13 commented 1 month ago

Thank you for the hint, although that doesn't seem to have helped.

I am trying this out of Visual Studio.

I went as far as closing Visual Studio, manually deleting the bin and obj folders in each project folder, then re-opening the solution, and running the GitReleaseManager.Tool project.

The contributors are still not being added into the generated release notes.

gep13 commented 1 month ago

Just tried using the GitReleaseManager.Cli as the startup project, and it is having the same result.

Jericho commented 1 month ago

Please set a break point on line 66 in ReleaseNotesBuilderIntegrationTests.cs and run the SingleMilestone unit test. It will generate the notes for GRM version 0.12.0 which contains a good mix of issues, PRs, excluded labels and, more importantly for the case at hand, 10 different people contributed to this release. When Visual Studio hits your break point, hover your mouse over the result variable and click on View. You should get a popup window where you'll be able to eyeball the generated release notes. I just ran this unit test and here's what I get:

image

Do you get the same?

gep13 commented 1 month ago

No, I do not :-(

image

Although, I do get contributors back:

image
Jericho commented 1 month ago

Is there a possibility that, somehow, you managed to override the built-in template with your own?

Also, can you verify that you have the expected index.sbn which should look like this: image

Jericho commented 1 month ago

And while we're on the topic of templates, double-check the presence of contributors.sbn and contributor-details.sbn in the src\GitReleaseManager.Core\Templates\default folder.

gep13 commented 1 month ago

While I do make use of custom templates on some projects, I can confirm that none are in play when testing this PR. I can confirm this here:

image

Where the default file path, i.e. the embedded resource, is being used.

Yes, I can confirm that the index.sbn is the same as your screenshot.

And yes, I can also confirm that the two contributor sbn files are in that folder.

gep13 commented 1 month ago

Doh! I have figured it out...

I suddenly remembered about the .tt file!

image

You have to right click on that, and then click Run Custom Tool to have it generate the .cs file, which is then embedded into the assembly.

I don't know exactly when this is run as part of the normal build process, but it might also explain why you found you had to clean the files in order to get things to work properly.

@AdmiringWorm might be able to provide some insight into when this part of the tooling works. Thinking about it, I "think" it runs as part of the Cake build, but I thought it ran inside Visual Studio as well.

Now that I have this working, I should be able to take this for a proper trial.

AdmiringWorm commented 1 month ago

@AdmiringWorm might be able to provide some insight into when this part of the tooling works. Thinking about it, I "think" it runs as part of the Cake build, but I thought it ran inside Visual Studio as well.

It is indeed run as part of the Cake build, it is a separate task called Transform-TextTemplates. Do note that it is not the same as when running it through Visual Studio (not sure why, but the support in VS seems to become worse and worse for TT templates), but it should be close enough.