-
Notifications
You must be signed in to change notification settings - Fork 356
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
chore: automatic update contributors list #4029
Conversation
📊 Benchmark resultsComparing with 9975b53 Package size: 377 MB⬆️ 0.00% increase vs. 9975b53
Legend
|
d5fdaa4
to
890ff6f
Compare
tools/contributors.mjs
Outdated
const packageJsonContributors = contributors.map((user) => { | ||
const web = (user.twitter_username && `https://twitter.com/${user.twitter_username}`) || user.blog | ||
let fullName = user.name || user.login | ||
let email = mailList.get(user.login) || mailList.get(user.name) || user.email |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe someone has a better idea of getting the email address sadly there is nothing matching from the github api so I have to manual match them with the users
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we only show the person's URL, without the email address? This is what all-contributors
does for example. This might be better from a privacy standpoint, and might help you solve that implementation problem.
Note: the all-contributors
codebase might be useful to browse too to compare how they are getting the user information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh thx :) I was just trying to get the information that was already provided in the package.json
.github/workflows/contributors.yml
Outdated
check-latest: true | ||
- name: Install dependencies | ||
run: npm ci --no-audit | ||
- name: Generate Contributors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might be able to use https://github.com/actions/github-script#run-a-separate-file-with-an-async-function for this.
It will save us from installing the octokit
dependencies directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to wait for actions/github-script#168 or use commonJS
syntax
1ef1794
to
afa187f
Compare
tools/contributors.mjs
Outdated
const PagedOctokit = Octokit.plugin(paginateRest) | ||
const octokit = new PagedOctokit({ auth: GITHUB_TOKEN }) | ||
|
||
const contributorList = await octokit.paginate('GET /repos/{owner}/{repo}/contributors', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will give us the existing contributors list, so I'm not sure if it includes first time contributors.
That is, if a first time user opens a PR, their name won't be added in that PR, but in the next one (I think), which can be confusing.
We probably want to look at the git log
for the current commit, and use that as a reference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a better way will be to take the PR author from the GitHub action event and use that one. It can save use the trouble of parsing git log
and linking it to GitHub profiles
@erezrokah I though moving this maybe in a seperate own github action that we can share across the organization? any thoughts on this? Will post it in our (internal) slack |
Yes please! This is a great idea |
48226b6
to
a00779f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lukasholzer I stole the code from this PR and moved it to https://github.com/netlify/update-contributors-action.
Also handled the case of adding the current actor https://github.com/netlify/update-contributors-action/blob/0409f900ca26df7f0b876b98144ebd6f833c36ea/src/update.ts#L83
🎉 Thanks for submitting a pull request! 🎉
Summary
Fixes https://github.com/netlify/pod-workflow/issues/355
To keep our package.json contributors field up to date to value the effort of each individual person who is contributing to the CLI I'm adding a github actions that runs on every PR to update the contributors field.
For us to review and ship your PR efficiently, please perform the following steps:
passes our tests.
A picture of a cute animal (not mandatory, but encouraged)