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

Automatically crediting the author/contributor of the PR in the release notes #89

Closed
ghuntley opened this issue Nov 3, 2016 · 12 comments · Fixed by #541
Closed

Automatically crediting the author/contributor of the PR in the release notes #89

ghuntley opened this issue Nov 3, 2016 · 12 comments · Fixed by #541
Assignees
Labels
Milestone

Comments

@ghuntley
Copy link

ghuntley commented Nov 3, 2016

Let's discuss a potential feature/addition to GitReleaseManager!

image

Why? People like seeing their name up in lights, it a small gesture and a great way to encourage contributions. This functionality exists in GitReleaseNotes.

@gep13
Copy link
Member

gep13 commented Nov 4, 2016

@ghuntley yes, I like this idea. If you have a look at this blog post:

http://cakebuild.net/blog/2016/09/cake-v0-16-0-released

I have some working code to generate the list of contributors that you can see there. Adding that to an item in the release notes is "harder". An issue might have been created by one person, and fixed by another via a pull request. Stitching the two together is where it becomes hard. Not impossible, just not sure how much effort it will take.

The list of contributors is very simple to generate.

@ghuntley
Copy link
Author

ghuntley commented Nov 4, 2016

List of contributors, with a hyperlink to commits by author would suffice imho.

@gep13
Copy link
Member

gep13 commented Nov 4, 2016

@ghuntley yes, that sounds doable 😄

@ghuntley
Copy link
Author

Some other ideas which are kinda glamourous :)

https://twitter.com/RobertWPearce/status/910978463586074625

screenshot_20170922-081612

Why have a hyperlink when you can put someone's avatar in the release notes?

@gep13 gep13 added this to the 0.11.0 milestone Jan 6, 2020
@gep13 gep13 added the Feature label Jan 6, 2020
@gep13 gep13 modified the milestones: 0.11.0, 0.12.0 Mar 16, 2020
@gep13 gep13 modified the milestones: 0.12.0, Future Mar 22, 2021
@Jericho
Copy link
Contributor

Jericho commented Nov 3, 2023

Two things to keep in mind:

  • milestone can contain issues as well as PRs
  • Issues may or may not be linked to a PR and, similarly, PRs may or may not be linked to an issue

In my opinion, the ultimate solution for this feature would be something like this:

  1. Properly attribute each issue/PR and also display info about the linked issue/PR if possible. Like so:

    1. When issue is not linked to a PR: [#xxx](<issue URL>) <title of the issue> raised by [<author or the issue>](<issue author's GitHub profile URL>)
    2. When issue is linked to a PR: [#xxxx](<issue URL>) <title of the issue> raised by [<author or the issue>](<issue author's GitHub profile URL>) resolved in [#zzz](<PR URL>) by [<author or the PR>](<PR author's GitHub profile URL>)
    3. When PR is not linked to an issue: [#xxx](<PR URL>) <title of the PR> by [<author or the PR>](<PR author's GitHub profile URL>)
    4. When PR is linked to an issue: [#xxxx](<PR URL>) <title of the PR> by [<author or the PR>](<PR author's GitHub profile URL>) raised in [#zzz](<issue URL>) by [<author or the issue>](<issue author's GitHub profile URL>)
  2. Contributors summary
    Display a summary of all the users who contributed to the release. Something similar to this:
    image
    This screenshot was taken from the Octokit.net release notes here

I'm currently working on a proof of concept. If I'm successful I'll be happy to contribute a PR to implement this new feature.

@gep13
Copy link
Member

gep13 commented Nov 3, 2023

This would be a great addition!

@Jericho
Copy link
Contributor

Jericho commented Nov 4, 2023

Determining if an issue is linked to a PR (and vice-versa) is turning out to be much more difficult than I anticipated because the Github API does not return this info when an issue is retrieved. I did a lot of research and I found people offering two possible solutions:

  1. retrieve the events in the issue "timeline", attempt to figure out which even corresponds to "issue was linked to PR", and finally try to figure which issue/PR is being referenced
  2. parse the HTML from Github's web site for this particular issue and search an element with a specific CSS class name. If this element contains an anchor, the "href" property of this anchor will reveal the unique identifier of the issue/PR in question

The first option would be my preferred solution but, as I explained in this comment, I hit a dead end.

The second option (presented here) is very brittle since it relies on the presence of a HTML node with a specific CSS class. This can change at any moment if Github decides to make changes to their UI.

@Jericho
Copy link
Contributor

Jericho commented Nov 4, 2023

Maybe there's a third possible solution: use a GraphQL query to retrieve the desired data. I haven't explored Github GraphQL API, so this will be a learning experience for me. I'll spend some time researching/learning and report my findings.

@Jericho
Copy link
Contributor

Jericho commented Nov 5, 2023

Status update
I am able to figure out the linked issue/PR using a GraphQL query and I can generate release notes like this:
image

In the above example, the two highlighted issues have a linked PR. This works great in most cases!

However I discovered that in some case, for a reason I can't explain, the Github GraphQL API returns an empty array of events when fetching the timeline for a given issue which, obviously, prevents my logic from determining the given issue has a linked PR.

@Jericho
Copy link
Contributor

Jericho commented Nov 5, 2023

Status update
I am also able to generate a summary of people who made a contribution towards the release (meaning they either raised an issue or submitted a PR):
image

@Jericho
Copy link
Contributor

Jericho commented Nov 13, 2023

I didn't realize until yesterday that a single PR could be linked to more than one issue like in this example:
image

This also applies to issues: they can be linked to more than one PR.

I need to update my PR to account for this possibility.

Also, GitReleaseManager was recently updated to support GitLab in addition to GitHub. I need to modify my PR to also support GitLab.

@gep13 gep13 modified the milestones: Future, 0.17.0 Feb 12, 2024
@gep13 gep13 modified the milestones: 0.17.0, Future Mar 9, 2024
@gep13 gep13 modified the milestones: Future, 0.19.0 Feb 20, 2025
gep13 pushed a commit to Jericho/GitReleaseManager that referenced this issue Feb 20, 2025

Verified

This commit was signed with the committer’s verified signature.
SuperQ Ben Kochie
This commit adds the ability to query for, and add, information about
the contributors for linked issues and PR's into the generated release
notes.

This is made possible via a new `include-contributors` option in the
create section of the GitReleaseManager.yaml file.  This is false by
default.

In addition, a new scriban template has been created, so allow complete
segregation between release notes that have contributors, and those that
don't. This was done mainly to allow better maintainability going
forward, and to reduce the complexity of the default template.

This has been implemented for both GitHug and GitLab.  For GitHub, it
was necessary to use GraphQL to get the necessary information, where as
with GitLab, the required information could be returned via the REST API.
gep13 added a commit to Jericho/GitReleaseManager that referenced this issue Feb 20, 2025
During testing, it was found that release notes containing contributors
could not be created, since there was an exception thrown when trying
to map models.  Digging into the problem, there were some missing
mappings, and also some required translations between properties with
different names.

Once these addition mappings were in place, it was possible to create
release notes, with contributors, in both GitHub and GitLab.
gep13 added a commit that referenced this issue Feb 20, 2025
(#89) Add ability to populate release notes with information about contributors
gep13 added a commit that referenced this issue Feb 20, 2025
* release/0.19.0: (44 commits)
  (build) Make use of new GRM features
  (doc) Remove unnecessary space.
  (doc) Document the new set-due-date option
  (doc) Fixed formatting
  (doc) Document the new include-contributors option
  (#89) Add required mappings for GitLab models
  (#89) Include contributors in release notes
  (#568) Set the 'Due date' when closing a milestone
  Bump coverlet.msbuild from 6.0.3 to 6.0.4 in /src in the tests group
  Bump Roslynator.Analyzers
  Bump Shouldly from 4.2.1 to 4.3.0 in /src
  Bump cake-build/cake-action from 2 to 3
  Bump Microsoft.Extensions.DependencyInjection in /src
  Bump NGitLab from 7.1.0 to 7.6.0 in /src
  (build) Install .NET 7.0 on build machine
  Bump NGitLab from 7.0.1 to 7.1.0 in /src
  Bump NUnit3TestAdapter from 4.5.0 to 4.6.0 in /src
  Bump NUnit from 4.1.0 to 4.3.2 in /src
  Bump Destructurama.Attributed and Serilog in /src
  Bump Microsoft.Extensions.DependencyInjection in /src
  ...
@gittools-bot
Copy link
Contributor

🎉 This issue has been resolved in version 0.19.0 🎉

The release is available on:

Your GitReleaseManager bot 📦🚀

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