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

Add contributors badges to Github Releases #248

Closed
3 tasks done
StarpTech opened this issue Jul 7, 2022 · 7 comments · Fixed by #272
Closed
3 tasks done

Add contributors badges to Github Releases #248

StarpTech opened this issue Jul 7, 2022 · 7 comments · Fixed by #272
Labels

Comments

@StarpTech
Copy link
Contributor

Clear and concise description of the problem

As titled. Example https://github.com/wundergraph/wundergraph/releases/tag/v0.94.0

Suggested solution

See https://github.com/wundergraph/wundergraph/releases/tag/v0.94.0

Alternative

No response

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@ghiscoding
Copy link
Member

that's a good suggestion but I wouldn't know how to add this suggested feature, if you know how to please provide a PR

@StarpTech
Copy link
Contributor Author

This is happening automatically as soon as we reference the contributor by name in the changelogs.

@ghiscoding
Copy link
Member

ghiscoding commented Jul 7, 2022

I'm not exactly sure what you mean but the release seems to be created in this file create-release.ts which then calls github-client.ts when the repo is on GitHub. It's getting his info from Octokit, so I don't know if that can pull the contributors but some of these 2 files must be updated to do what you want to do

EDIT

after looking a bit how the release is created, whatever is displayed in the release actually comes from the conventional-changelog, so for this to work then the changelog creation would have to include the contributor/user and I'm not sure conventional-changelog provides this kind of info (at first glance it doesn't look like it). This git command seems to provide contributor git show -s --format="%cn" <commitId> or git log --format='%cn' <commitId>^!, maybe we can put that somewhere in the changelog creation

@ghiscoding
Copy link
Member

ghiscoding commented Jul 7, 2022

it might be doable to change the changelog creation format according to conventional-changelog/git-raw-commits we can provide the format option and the default is %B (which is the commit body) but if we change it to '%B (@%cn)' then we would get something similar to your format, I tried the command on another repo and got this (there seems to be adding an extra line break, not sure why though). The format available options can be found here

$ git log -1 --format='%B (@%cn)' ccbf7bf
chore(release): 4.2.4
 (@ghiscoding)

the git raw commit is used in the changelog creation here

https://github.com/ghiscoding/lerna-lite/blob/e21405196247a765ee72c14850e34a1e3af12c53/packages/core/src/conventional-commits/update-changelog.ts#L48

so perhaps that could be changed with the new format option

EDIT

It seems really hard to add the author to changelog as per this conventional-changelog issue opened. I believe I found a way but it requires string replacement, or I should say it requires manipulation of the changelog string

@ghiscoding
Copy link
Member

ghiscoding commented Jul 11, 2022

@StarpTech you can review the PR #253, it's a bit hacky to circumvent the missing feature from conventional-changelog lib itself and you can read all about it in the PR. However also please note that I would prefer to wait before merging it to include your own PR (when ready) to release all of the new features at the same time. Thanks

@ghiscoding
Copy link
Member

ghiscoding commented Jul 20, 2022

Reopening since I just found out that the first code implementation was adding the author's full name (which is what git is holding) instead of the preferable git username which are not the same. It looks like we could use the GitHub API (we can use Octokit) to read commit username. The negative side effect of using GitHub API is that it requires an extra API call but it will also only work with GitHub and it would require completely different implementation for other systems like GitLab, Azure or other enterprise git servers. See this SO for reference

Example with GitHub API using a REST call

https://api.github.com/repos/ghiscoding/lerna-lite/commits?since=2022-07-01&per_page=5000

it's most probably a lot better to use GraphQL to avoid querying ton of info just to get the user login, see Octokit GraphQL example.

Considering all of that, I might actually keep the first implementation but rename the flag to focus on the author's full name and add a second flag that would use the GitHub API. Something along

  • --changelog-include-commit-author-fullname
  • --changelog-include-commit-author-username
    and it might also be nice to be able to provide a format like we can do with --changelog-header-message <msg>

For GitLab, they also have their GitLab API with commits, however it doesn't seem to include the user name but that can be pulled from users API, perhaps that can be combined with GraphQL

@ghiscoding ghiscoding added wip work is in progress and removed has PR wip work is in progress labels Jul 21, 2022
ghiscoding added a commit that referenced this issue Jul 27, 2022
…entry, closes #248 (#272)

* feat(version): option to add commit login username on each changelog entry, closes #248
@ghiscoding
Copy link
Member

ghiscoding commented Jul 28, 2022

This is now available in latest release v1.9.0, more info at version#--changelog-include-commits-client-login-msg

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