Skip to content

Commit

Permalink
feature: support all contributors (#66)
Browse files Browse the repository at this point in the history
* support all contributors

* check if parseable JSON with jq

* try again

* missing space

* fixes

* debugging

* two separate files

* pass in variable with --arg to jq

* ran prettier

* [bot] Update contributors.json

---------

Co-authored-by: tyliec <tyliec@users.noreply.github.com>
  • Loading branch information
tyliec and tyliec authored Feb 25, 2024
1 parent f83c5e9 commit c9e261d
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 27 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,40 @@ jobs:
sed -i '$ s/.$//' contributors.json
echo "}}" >> contributors.json
cat contributors.json
- name: Collect all the contributors from allcontributors files
run: |
repositories=${{env.REPOSITORY_NAMES}}
for repository in ${repositories[@]}
do
echo "Collecting contributors for $repository"
curl -s https://raw.githubusercontent.com/CodeWithAloha/$repository/main/.all-contributorsrc > $repository-contributors.json
cat $repository-contributors.json
if ! jq -e . >/dev/null 2>&1 <<< "$(cat $repository-contributors.json)"; then
echo "No contributors for $repository, or .all-contributorsrc is not valid JSON"
rm $repository-contributors.json
continue
fi
cat $repository-contributors.json | jq -r '.contributors[] | {username: .login, avatar_url: .avatar_url, url: .profile }' | jq -s . > $repository-output.json
echo "Contributors found for $repository"
cat $repository-output.json
jq --argjson newContributors "$(cat $repository-output.json)" \
--arg repo "$repository" \
'.contributors[$repo] |= (. + $newContributors) |
.contributors[$repo] |= unique_by(.username)' \
"contributors.json" > temp.json && mv temp.json "contributors.json"
rm $repository-contributors.json
rm $repository-output.json
done
cat contributors.json
- name: Use Node.js
uses: actions/setup-node@v3
Expand Down
74 changes: 47 additions & 27 deletions contributors.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,74 @@
"contributors": {
"Hawaii-Zoning-Atlas": [
{
"username": "kmal808",
"avatar_url": "https://avatars.githubusercontent.com/u/20919083?v=4",
"url": "https://github.com/kmal808"
},
{
"username": "tyliec",
"avatar_url": "https://avatars.githubusercontent.com/u/15609358?v=4",
"url": "https://github.com/tyliec"
"username": "Hooobot",
"avatar_url": "https://avatars.githubusercontent.com/u/73650949?v=4",
"url": "https://github.com/Hooobot"
},
{
"username": "avenmia",
"avatar_url": "https://avatars.githubusercontent.com/u/17712276?v=4",
"url": "https://github.com/avenmia"
},
{
"username": "operator130",
"avatar_url": "https://avatars.githubusercontent.com/u/105579826?v=4",
"url": "https://github.com/operator130"
"username": "MichelleShuey",
"avatar_url": "https://avatars.githubusercontent.com/u/120435891?v=4",
"url": "https://github.com/MichelleShuey"
},
{
"username": "TyPushesButtons",
"avatar_url": "https://avatars.githubusercontent.com/u/124652716?v=4",
"url": "https://github.com/TyPushesButtons"
},
{
"username": "Hooobot",
"avatar_url": "https://avatars.githubusercontent.com/u/73650949?v=4",
"url": "https://github.com/Hooobot"
"username": "airyclam",
"avatar_url": "https://avatars.githubusercontent.com/u/53859607?v=4",
"url": "https://github.com/airyclam"
},
{
"username": "avenmia",
"avatar_url": "https://avatars.githubusercontent.com/u/17712276?v=4",
"url": "https://github.com/avenmia"
},
{
"username": "ggordn3r",
"avatar_url": "https://avatars.githubusercontent.com/u/10144772?v=4",
"url": "https://github.com/ggordn3r"
},
{
"username": "yenhtran",
"avatar_url": "https://avatars.githubusercontent.com/u/7283964?v=4",
"url": "https://github.com/yenhtran"
},
{
"username": "airyclam",
"avatar_url": "https://avatars.githubusercontent.com/u/53859607?v=4",
"url": "https://github.com/airyclam"
"username": "jonathanswilcox",
"avatar_url": "https://avatars.githubusercontent.com/u/111539042?v=4",
"url": "https://github.com/jonathanswilcox"
},
{
"username": "kcoronel",
"avatar_url": "https://avatars.githubusercontent.com/u/38144130?v=4",
"url": "https://github.com/kcoronel"
},
{
"username": "kenz-bee",
"avatar_url": "https://avatars.githubusercontent.com/u/100083618?v=4",
"url": "https://github.com/kenz-bee"
},
{
"username": "kmal808",
"avatar_url": "https://avatars.githubusercontent.com/u/20919083?v=4",
"url": "https://github.com/kmal808"
},
{
"username": "kobebuckley",
"avatar_url": "https://avatars.githubusercontent.com/u/42805189?v=4",
"url": "https://github.com/kobebuckley"
},
{
"username": "operator130",
"avatar_url": "https://avatars.githubusercontent.com/u/105579826?v=4",
"url": "https://github.com/operator130"
},
{
"username": "tyliec",
"avatar_url": "https://avatars.githubusercontent.com/u/15609358?v=4",
"url": "https://github.com/tyliec"
},
{
"username": "yenhtran",
"avatar_url": "https://avatars.githubusercontent.com/u/7283964?v=4",
"url": "https://github.com/yenhtran"
}
],
"HIERR": [
Expand Down Expand Up @@ -155,6 +170,11 @@
"avatar_url": "https://avatars.githubusercontent.com/u/73650949?v=4",
"url": "https://github.com/Hooobot"
},
{
"username": "kahookele",
"avatar_url": "https://avatars.githubusercontent.com/u/130222500?v=4",
"url": "https://github.com/kahookele"
},
{
"username": "avenmia",
"avatar_url": "https://avatars.githubusercontent.com/u/17712276?v=4",
Expand Down

0 comments on commit c9e261d

Please sign in to comment.