Skip to content

fix: initialize missing contributor table - #687

Open
psnikhilesh wants to merge 2 commits into
all-contributors:mainfrom
psnikhilesh:fix/init-missing-contributor-table-201
Open

psnikhilesh wants to merge 2 commits into
all-contributors:mainfrom
psnikhilesh:fix/init-missing-contributor-table-201

Conversation

@psnikhilesh

Copy link
Copy Markdown

What: Initialize missing contributor markers in configured content files when .all-contributorsrc already 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:

  • Documentation (not needed)
  • Ready to be merged
  • Added myself to contributors table (not applicable)

Verification: all 67 tests pass; ESLint and git diff --check pass.

@vercel

vercel Bot commented Nov 16, 2026

Copy link
Copy Markdown

@psnikhilesh is attempting to deploy a commit to the All Contributors Team on Vercel.

A member of the Team first needs to authorize it.

@psnikhilesh

Copy link
Copy Markdown
Author

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 michaelfaith left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good start! Just requesting a slight tweak in the approach.

Comment thread lib/add-contributor.js Outdated
Comment on lines +46 to +47
const hasConfig = config.getOriginalSha() !== undefined;
contentFiles.init({ force: !hasConfig, preserveExistingBadge: hasConfig });

@michaelfaith michaelfaith Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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?

@psnikhilesh
psnikhilesh force-pushed the fix/init-missing-contributor-table-201 branch from 2ec419f to 210eb1e Compare November 16, 2026 12:23
@psnikhilesh

psnikhilesh commented Nov 16, 2026 •

Copy link
Copy Markdown
Author

Thanks for the feedback! I've updated and pushed the fix so initialization checks the content files for existing contributor markers regardless of whether .all-contributorsrc exists. Could you please take another look and merge it if it addresses your concern? It would be a big help for my college internal marks. I wasn't able to rerun the tests locally because dependency installation is blocked by a Windows sandbox symlink permission issue.

@michaelfaith michaelfaith left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +42 to +45
const contentWithBadge = hasBadge ? content : initBadge(content);
const contentWithList = hasList
? contentWithBadge
: initContributorsList(contentWithBadge);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 michaelfaith left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@michaelfaith
michaelfaith requested a review from a team November 16, 2026 19:10

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle case where no all-contributors table exists in file, but .all-contributorsrc exists in the repository

2 participants