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

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

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

jamszh
Copy link

@jamszh jamszh commented Apr 30, 2023

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.

@jamszh jamszh requested review from a team as code owners 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
docs/manifest-releaser.md Outdated Show resolved Hide resolved
import {PullRequestBody} from '../../src/util/pull-request-body';
import {Version} from '../../src/version';
const presetFactory = require('conventional-changelog-conventionalcommits');

const COMMIT_WITH_AUTHOR_FORMAT = '{{#if authors}} by {{authors}}\n {{~/if}}\n';
Copy link
Author

@jamszh jamszh Jun 23, 2023

Choose a reason for hiding this comment

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

Add PR author to a commit entry for the generated release notes.

I wonder if this feature be default or opt-in.

@jamszh jamszh mentioned this pull request Jul 1, 2023
4 tasks
@JohnCampionJr
Copy link

JohnCampionJr commented Jul 8, 2023

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.

Copy link
Contributor

@chingor13 chingor13 left a comment

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.

const changelogNotes = buildChangelogNotes({
type: options.changelogType || 'default',
github: options.github,
changelogSections: options.changelogSections,
commitPartial,
Copy link
Author

@jamszh jamszh Sep 12, 2023

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
Copy link
Author

jamszh commented Sep 12, 2023

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
Copy link
Author

jamszh commented Sep 12, 2023

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
Copy link

jxn-30 commented May 18, 2024

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
Copy link
Author

jamszh commented Aug 8, 2024

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.

Copy link
Contributor

@chingor13 chingor13 left a comment

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
Copy link
Author

jamszh commented Sep 17, 2024

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).

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
5 participants