Repository navigation
fix: initialize missing contributor table - #687
psnikhilesh wants to merge 2 commits into
Conversation
|
@psnikhilesh is attempting to deploy a commit to the All Contributors Team on Vercel. A member of the Team first needs to authorize it. |
|
Vercel reports “Authorization required to deploy” for this PR. Could a maintainer authorize the deployment, or let me know if previews are disabled for external contributions? The tests pass locally. |
michaelfaith
left a comment
There was a problem hiding this comment.
Good start! Just requesting a slight tweak in the approach.
| const hasConfig = config.getOriginalSha() !== undefined; | ||
| contentFiles.init({ force: !hasConfig, preserveExistingBadge: hasConfig }); |
There was a problem hiding this comment.
I don't think the presence or absence of the config file should change the init behavior. Because, let's say that someone has a fully-formed contributor list already, because they copied it from another project, but don't have the config yet. This would now yield unexpected results. I think the init function should just be able to assess whether or not the file needs these things, add them if it does, and don't if it doesn't. Regardless of the state of the config. Does that make sense?
2ec419f to
210eb1e
Compare
|
Thanks for the feedback! I've updated and pushed the fix so initialization checks the content files for existing contributor markers regardless of whether |
michaelfaith
left a comment
There was a problem hiding this comment.
Looks good! Just going to wait another day or two for a second approval, and then we'll take care of the merge, if there's no other feedback.
| const contentWithBadge = hasBadge ? content : initBadge(content); | ||
| const contentWithList = hasList | ||
| ? contentWithBadge | ||
| : initContributorsList(contentWithBadge); |
There was a problem hiding this comment.
It looks like if the badge isn't there but the list is, then it won't attempt to add the badge. I think that's probably ok, since the person may have intentionally removed the badge 👍, but just calling that out.
michaelfaith
left a comment
There was a problem hiding this comment.
Actually, after approving CI, it looks like there are format and test failures. So I'll wait until those are resolved to reapprove. The approach looks sound, though.
What: Initialize missing contributor markers in configured content files when
.all-contributorsrcalready exists. Preserve an existing badge to avoid duplicates.Why: Fixes #201. Repositories with an existing config but missing README contributor markers currently do not get the missing sections initialized.
How: Initialize missing badge/list sections idempotently and add an integration regression test for an existing badge with no contributor-list markers.
Checklist:
Verification: all 67 tests pass; ESLint and
git diff --checkpass.