all-contributors / cli

Tool to help automate adding contributor acknowledgements according to the all-contributors specification ✨
https://allcontributors.org
Other
413 stars 144 forks source link

Adding multiple contributions partially overrides a contributor's existing ones #355

Closed JoshuaKGoldberg closed 1 year ago

JoshuaKGoldberg commented 1 year ago

Describe the bug

If you add multiple ,-separated contributions with all-contributors add, then only some of the new contributions may be added. It's very odd.

This does not reproduce if you only add one contribution at a time.

To Reproduce

See https://github.com/JoshuaKGoldberg/repros/tree/all-contributors-multiple.

git clone -b all-contributors-multiple https://github.com/JoshuaKGoldberg/repros
cd repros
npm i

Adding a single contribution for a contributor successfully adds them to .all-contributorsrc:

npx all-contributors add joshuakgoldberg content
"contributions": [
  "bug",
+  "content"
]

But, adding multiple contributions partially overrides any existing contributions:

npx all-contributors add joshuakgoldberg docs,example
"contributions": [
  "bug",
+  "example"
]

...and then running the same command again ends up with just "example" listed (?!):

"contributions": [
-  "bug",
+  "example"
]

Expected behavior

Adding new contributors should exclusively add, not take away.

Berkmann18 commented 1 year ago

Is that happening with any particular version? I wonder if it's a regression.

JoshuaKGoldberg commented 1 year ago

Hmm, now I can't repro it. Also maybe it's that I was typoing and using docs instead of doc? Will close - thanks!

Berkmann18 commented 1 year ago

That's possible (especially since the bot will know what you mean but not the CLI).