Skip to content

Commit c9e261d

Browse files
authored
feature: support all contributors (#66)
* 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 <[email protected]>
1 parent f83c5e9 commit c9e261d

File tree

2 files changed

+81
-27
lines changed

2 files changed

+81
-27
lines changed

.github/workflows/contributors.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,40 @@ jobs:
5454
sed -i '$ s/.$//' contributors.json
5555
echo "}}" >> contributors.json
5656
57+
cat contributors.json
58+
59+
- name: Collect all the contributors from allcontributors files
60+
run: |
61+
repositories=${{env.REPOSITORY_NAMES}}
62+
for repository in ${repositories[@]}
63+
do
64+
echo "Collecting contributors for $repository"
65+
curl -s https://raw.githubusercontent.com/CodeWithAloha/$repository/main/.all-contributorsrc > $repository-contributors.json
66+
67+
cat $repository-contributors.json
68+
69+
if ! jq -e . >/dev/null 2>&1 <<< "$(cat $repository-contributors.json)"; then
70+
echo "No contributors for $repository, or .all-contributorsrc is not valid JSON"
71+
rm $repository-contributors.json
72+
continue
73+
fi
74+
75+
cat $repository-contributors.json | jq -r '.contributors[] | {username: .login, avatar_url: .avatar_url, url: .profile }' | jq -s . > $repository-output.json
76+
77+
echo "Contributors found for $repository"
78+
cat $repository-output.json
79+
80+
jq --argjson newContributors "$(cat $repository-output.json)" \
81+
--arg repo "$repository" \
82+
'.contributors[$repo] |= (. + $newContributors) |
83+
.contributors[$repo] |= unique_by(.username)' \
84+
"contributors.json" > temp.json && mv temp.json "contributors.json"
85+
86+
rm $repository-contributors.json
87+
rm $repository-output.json
88+
89+
done
90+
5791
cat contributors.json
5892
- name: Use Node.js
5993
uses: actions/setup-node@v3

contributors.json

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,74 @@
22
"contributors": {
33
"Hawaii-Zoning-Atlas": [
44
{
5-
"username": "kmal808",
6-
"avatar_url": "https://avatars.githubusercontent.com/u/20919083?v=4",
7-
"url": "https://github.com/kmal808"
8-
},
9-
{
10-
"username": "tyliec",
11-
"avatar_url": "https://avatars.githubusercontent.com/u/15609358?v=4",
12-
"url": "https://github.com/tyliec"
5+
"username": "Hooobot",
6+
"avatar_url": "https://avatars.githubusercontent.com/u/73650949?v=4",
7+
"url": "https://github.com/Hooobot"
138
},
149
{
15-
"username": "avenmia",
16-
"avatar_url": "https://avatars.githubusercontent.com/u/17712276?v=4",
17-
"url": "https://github.com/avenmia"
18-
},
19-
{
20-
"username": "operator130",
21-
"avatar_url": "https://avatars.githubusercontent.com/u/105579826?v=4",
22-
"url": "https://github.com/operator130"
10+
"username": "MichelleShuey",
11+
"avatar_url": "https://avatars.githubusercontent.com/u/120435891?v=4",
12+
"url": "https://github.com/MichelleShuey"
2313
},
2414
{
2515
"username": "TyPushesButtons",
2616
"avatar_url": "https://avatars.githubusercontent.com/u/124652716?v=4",
2717
"url": "https://github.com/TyPushesButtons"
2818
},
2919
{
30-
"username": "Hooobot",
31-
"avatar_url": "https://avatars.githubusercontent.com/u/73650949?v=4",
32-
"url": "https://github.com/Hooobot"
20+
"username": "airyclam",
21+
"avatar_url": "https://avatars.githubusercontent.com/u/53859607?v=4",
22+
"url": "https://github.com/airyclam"
23+
},
24+
{
25+
"username": "avenmia",
26+
"avatar_url": "https://avatars.githubusercontent.com/u/17712276?v=4",
27+
"url": "https://github.com/avenmia"
3328
},
3429
{
3530
"username": "ggordn3r",
3631
"avatar_url": "https://avatars.githubusercontent.com/u/10144772?v=4",
3732
"url": "https://github.com/ggordn3r"
3833
},
3934
{
40-
"username": "yenhtran",
41-
"avatar_url": "https://avatars.githubusercontent.com/u/7283964?v=4",
42-
"url": "https://github.com/yenhtran"
43-
},
44-
{
45-
"username": "airyclam",
46-
"avatar_url": "https://avatars.githubusercontent.com/u/53859607?v=4",
47-
"url": "https://github.com/airyclam"
35+
"username": "jonathanswilcox",
36+
"avatar_url": "https://avatars.githubusercontent.com/u/111539042?v=4",
37+
"url": "https://github.com/jonathanswilcox"
4838
},
4939
{
5040
"username": "kcoronel",
5141
"avatar_url": "https://avatars.githubusercontent.com/u/38144130?v=4",
5242
"url": "https://github.com/kcoronel"
5343
},
44+
{
45+
"username": "kenz-bee",
46+
"avatar_url": "https://avatars.githubusercontent.com/u/100083618?v=4",
47+
"url": "https://github.com/kenz-bee"
48+
},
49+
{
50+
"username": "kmal808",
51+
"avatar_url": "https://avatars.githubusercontent.com/u/20919083?v=4",
52+
"url": "https://github.com/kmal808"
53+
},
5454
{
5555
"username": "kobebuckley",
5656
"avatar_url": "https://avatars.githubusercontent.com/u/42805189?v=4",
5757
"url": "https://github.com/kobebuckley"
58+
},
59+
{
60+
"username": "operator130",
61+
"avatar_url": "https://avatars.githubusercontent.com/u/105579826?v=4",
62+
"url": "https://github.com/operator130"
63+
},
64+
{
65+
"username": "tyliec",
66+
"avatar_url": "https://avatars.githubusercontent.com/u/15609358?v=4",
67+
"url": "https://github.com/tyliec"
68+
},
69+
{
70+
"username": "yenhtran",
71+
"avatar_url": "https://avatars.githubusercontent.com/u/7283964?v=4",
72+
"url": "https://github.com/yenhtran"
5873
}
5974
],
6075
"HIERR": [
@@ -155,6 +170,11 @@
155170
"avatar_url": "https://avatars.githubusercontent.com/u/73650949?v=4",
156171
"url": "https://github.com/Hooobot"
157172
},
173+
{
174+
"username": "kahookele",
175+
"avatar_url": "https://avatars.githubusercontent.com/u/130222500?v=4",
176+
"url": "https://github.com/kahookele"
177+
},
158178
{
159179
"username": "avenmia",
160180
"avatar_url": "https://avatars.githubusercontent.com/u/17712276?v=4",

0 commit comments

Comments
 (0)