Add option to keep track of contributors in a separate json file
dgrcode opened this issue · 2 comments
Is your feature request related to a problem? Please describe.
It's hard to read ".all-contributorsrc" from JS to work with the list of contributors.
Describe the solution you'd like
It would be great to have a "contributors.json" file updated by the bot with the contents of the prop contributors
from the file ".all-contributorsrc". That way we could easily access the contributors as an array from JS and do things like create static pages for each contributor, create a view in a website, etc. We wouldn't be just limited to the Readme.
Describe alternatives you've considered
I've considered creating a node script that before pushing to a branch reads ".all-contributorsrc" and extract the relevant contributors
prop into a separate "contributors.json" file.
The problem with this alternative is that it requires a few extra steps:
- Current steps:
- Ask the bot to add someone
- Merge pull request
- Additional steps. It's not automated, so you need to remember to do them whenever All Contributors adds someone:
- Pull the latest changes on the default branch
- Checkout a new branch from that one
- Run the script, updating "contributors.json"
- Commit the changes
- Push the new commit
- Open a PR
- Merge PR
Additional context
Loading the ".all-contributorsrc" file as json is very simple on node, but it gets harder when using a bundler for frontend code (react, vue, etc), since the loaders don't know how to read the ".all-contributorsrc" extension. It's not that it's impossible to do it, but having a json file already updated by the bot would be super simple.
There might be a way to do this already by tweaking ".all-contributorsrc", but I haven't found it after looking around issues here, Stack Overflow and googling around.
I would rather not add that feature to the app. You are the first to ask for it as far as I know, and you can create your own file with a little automation yourself
I would suggest to create a GitHub Actions workflow that is triggered by the push
event to your repository's default branch, and filter the events using the on.push.paths
settings. In that action you'd update your own JSON file and push it back to the repository, as described here
I'll have a look at the GitHub Actions option. I hadn't thought about that before. Thanks for pointing it out! :)