Skip to content

feat(api): Add the ability to include commit authors and PR references to default-changelog-notes#1938

Open
jamszh wants to merge 21 commits into
googleapis:mainfrom
jamszh:author-commit-changelog
Open

feat(api): Add the ability to include commit authors and PR references to default-changelog-notes#1938
jamszh wants to merge 21 commits into
googleapis:mainfrom
jamszh:author-commit-changelog

Conversation

@jamszh

@jamszh jamszh commented Apr 30, 2023

Copy link
Copy Markdown

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Context:

Fixes #1716 🦕

This PR is a follow-up to #1717
We can probably close it as my PR is based off it.

Changes:

  • Utilise the commitPartial attribute from BaseStrategyOptions
  • Add commitPartialPath to the manifest config and friends
  • Commit authors and PR reference links can be added to the commit entries for a release by providing a custom .release-please-commit-partial.hbs file.
    • You can find the template file here (we default to this template when no commitPartialPath is provided)

TESTING

I have done testing on this dummy repo.
https://github.com/jamszh/test-release-please

You can provide a path to a custom commit-partial.hbs file like this one.

./build/src/bin/release-please.js release-pr --token $GITHUB_TOKEN --repo-url jamszh/test-release-please --target-branch main --commit-partial-path .release-please-commit-partial.hbs 

Here is an example auto-release PR generated by the command above.

For testing, the $GITHUB_TOKEN is a fine grain token with access to the test-release-please repo. I used these permissions.
image

@jamszh jamszh requested review from a team April 30, 2023 04:48
@product-auto-label product-auto-label Bot added the size: xl Pull request size is extra large. label Apr 30, 2023
@jamszh jamszh changed the title feat(api): Add the ability to include commit authors and PR references to generated changelogs feat(api): Add the ability to include commit authors and PR references to default-changelog-notes Apr 30, 2023
Comment thread docs/manifest-releaser.md Outdated
Comment thread test/changelog-notes/default-changelog-notes.ts
@jamszh jamszh mentioned this pull request Jul 1, 2023
4 tasks
@JohnCampionJr

JohnCampionJr commented Jul 8, 2023

Copy link
Copy Markdown

This would be very nice to have! Another related thought, maybe a list of excluded authors? For example, I wouldn't want myself listed by every single commit I do.

@chingor13 chingor13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry for the late review, but this is looking great!

One question -- is this opt-in? IMO, all the new features should not change existing behavior.

Comment thread src/factory.ts
type: options.changelogType || 'default',
github: options.github,
changelogSections: options.changelogSections,
commitPartial,

@jamszh jamszh Sep 12, 2023

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This feature is entirely opt-in.

commitPartial already existed as as optional argument prior to this PR.
It was just never used.

So now we provide a real value if commitPartialPath (newly added as part of this PR) is specified in the manifest file.

@jamszh

jamszh commented Sep 12, 2023

Copy link
Copy Markdown
Author

Sorry for the late review, but this is looking great!

One question -- is this opt-in? IMO, all the new features should not change existing behavior.

Yep.
See: https://github.com/googleapis/release-please/pull/1938/files#r1322981745

@jamszh

jamszh commented Sep 12, 2023

Copy link
Copy Markdown
Author

This would be very nice to have! Another related thought, maybe a list of excluded authors? For example, I wouldn't want myself listed by every single commit I do.

Yeah I can see this being annoying.
The exclusion list could work.

I was thinking we could also remove the @ from the author's user ID when building the notes.

Alternatively, I wonder if it is possible to supress the notifications for these Github mentions created by release-please.

@jamszh jamszh requested a review from chingor13 September 12, 2023 12:53
@jxn-30

jxn-30 commented May 18, 2024

Copy link
Copy Markdown

What is the current state of this PR?
Would love to see this, especially in combination with the beforementioned exclude-list!

Thanks for your work!

@jamszh

jamszh commented Aug 8, 2024

Copy link
Copy Markdown
Author

What is the current state of this PR? Would love to see this, especially in combination with the beforementioned exclude-list!

Thanks for your work!

I have updated the PR again. It should be ready for another review from @chingor13.
I'm thinking instead of an exclusion list, it might more sensible to add further customisation capabilities to this .hbs file.
Perhaps there is a way to list the authors at the PR level, rather than the commit level.

@chingor13 chingor13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks so close. I think we will want to pass the template string in the config, rather than making an extra GitHub API request to fetch the template from a file on the repository. The template contents should be small enough (generally a one-liner)

@jamszh

jamszh commented Sep 17, 2024

Copy link
Copy Markdown
Author

This looks so close. I think we will want to pass the template string in the config, rather than making an extra GitHub API request to fetch the template from a file on the repository. The template contents should be small enough (generally a one-liner)

The example template I used is quite big.
https://github.com/jamszh/test-release-please/blob/main/.release-please-commit-partial.hbs

Though i'm not too sure how others will use it

Are you saying we should have the contents of the 'commit-partial.hbs' file as part of the config?
It doesn't feel like a one-liner to me, especially if users want something more customized (hence more complicated).

@andrew-field

Copy link
Copy Markdown

Would love to see this merged. Thanks for your work!

@Oudwins

Oudwins commented Apr 18, 2025

Copy link
Copy Markdown

This would be amazing. Anything I can do to help push it over the edge?

@JustinElst

Copy link
Copy Markdown

This would be amazing!

@flying-sheep

Copy link
Copy Markdown

@chingor13 what’s holding this up?

@jamszh jamszh requested review from a team as code owners July 5, 2026 04:16
@jamszh

jamszh commented Jul 5, 2026

Copy link
Copy Markdown
Author

I've resolved the conflicts.

This PR has some overlap with #2628. Both introduce a way of attaching an author to a release note, however the solution provided by this PR is slightly more customisable (requires providing a commit-partial.hbs) and allows for structuring the entire note as opposed to simply appending a single author.

Regardless, I've ensured that the functionality introduced in #2628 is preserved. Both are opt-in.

I've re-tested - everything seems to be good.

Here is the PR with generated release notes with the update changes in this branch.

jamszh/test-release-please#5

@jamszh jamszh requested a review from chingor13 July 5, 2026 04:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: xl Pull request size is extra large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add commit fields to access authors and PR number

9 participants