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(version): option to add commit login username on each changelog entry, closes #248 #272

Merged
merged 7 commits into from Jul 27, 2022

Conversation

ghiscoding
Copy link
Member

@ghiscoding ghiscoding commented Jul 24, 2022

Description

Add new lerna version --changelog-include-commits-client-login [msg] option that will add commit remote client login username to each changelog commit line entry. This option will fetch all commits from the client remote server (only GitHub for now) and from that list it will find associated user login with commit changelog entry and will add them at the end of each changelog entry (when found), it uses the GitHub Graphql API to fetch all recent commits (since last release) from GitHub with only the fields we're interested in.

Motivation and Context

closes #248, which is to add user login on each changelog commit line and that will indirectly create a Contributors list when creating a new GitHub Release

Example with default format

**deps:** update dependency git-url-parse to v12 ([978bf36](https://github.com/.../978bf36)) (@renovate-bot)

or a custom format (use any of %a and/or %l)

lerna version --changelog-include-commits-client-login " by @%l, %a"

# result
**deps:** update dependency git-url-parse to v12 ([978bf36](https://github.com/.../978bf36)) by @renovate-bot, Whitesource Renovate

How Has This Been Tested?

added necessary unit tests and tested in git-dry-run mode to see changelog being updated as intended

Types of changes

  • Chore (change that has absolutely no effect on users)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@ghiscoding ghiscoding changed the title feat(version): option to add commit login username on each changelog entry, fixes #248 WIP - feat(version): option to add commit login username on each changelog entry, fixes #248 Jul 24, 2022
@ghiscoding ghiscoding added wip work is in progress feature labels Jul 24, 2022
@ghiscoding ghiscoding changed the title WIP - feat(version): option to add commit login username on each changelog entry, fixes #248 WIP - feat(version): option to add commit login username on each changelog entry, closes #248 Jul 24, 2022
@codecov
Copy link

codecov bot commented Jul 24, 2022

Codecov Report

Merging #272 (d33ddfb) into main (fb1852d) will increase coverage by 0.13%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #272      +/-   ##
==========================================
+ Coverage   93.84%   93.97%   +0.13%     
==========================================
  Files         142      144       +2     
  Lines        4105     4189      +84     
  Branches      848      874      +26     
==========================================
+ Hits         3852     3936      +84     
  Misses        253      253              
Impacted Files Coverage Δ
...kages/cli/src/cli-commands/cli-version-commands.ts 100.00% <ø> (ø)
...entional-commits/get-commits-since-last-release.ts 100.00% <100.00%> (ø)
...ore/src/conventional-commits/get-github-commits.ts 100.00% <100.00%> (ø)
packages/core/src/conventional-commits/index.ts 100.00% <100.00%> (ø)
.../core/src/conventional-commits/update-changelog.ts 100.00% <100.00%> (ø)
packages/version/src/version-command.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fb1852d...d33ddfb. Read the comment docs.

@ghiscoding ghiscoding changed the title WIP - feat(version): option to add commit login username on each changelog entry, closes #248 feat(version): option to add commit login username on each changelog entry, closes #248 Jul 26, 2022
@ghiscoding ghiscoding removed the wip work is in progress label Jul 26, 2022
@ghiscoding ghiscoding merged commit 2ca0dca into main Jul 27, 2022
@ghiscoding ghiscoding deleted the feat/changelog-commit-login branch July 27, 2022 20:27
@ghiscoding
Copy link
Member Author

Hello @MiguelSOliveira
I saw you commenting on Lerna project and didn't want to comment directly in Lerna, because I spent quite a lot of time to get it working in Lerna-Lite, but basically the feature you are asking about in Lerna (which is to have commit contributors in github releases) is available in Lerna-Lite (this repo) through the above PR. The way it works is that unfortunately GitHub username aren't available directly in git, however what we can do is to query the GitHub GraphQL API for all the commits since the last the last release and then loop through all the commits and add associated username through git hash mapping, this mapping is executed when the changelogs get updated (which is also used by the github release)

Lerna-Lite is a smaller/lighter version of Lerna, you can read more about it on its readme page

The full documentation on how to use it is available in the version --changelog-include-commits-client-login docs and below are 2 print screen sample of this feature used in Lerna-Lite project and another project of mine

last release of Lerna-Lite with contributors

image

another one of my project

image

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

Successfully merging this pull request may close these issues.

Add contributors badges to Github Releases
1 participant