From fc0e1b23a9677c9fb1ea76e0cf2ef928761cfadd Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Sat, 24 Feb 2024 18:22:00 -1000 Subject: [PATCH 01/10] support all contributors --- .github/workflows/contributors.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index b191551..7747b29 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -55,6 +55,31 @@ jobs: 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 | jq -r '.contributors[] | {username: .login, avatar_url: .avatar_url, url: .profile }' | jq -s . > $repository-contributors.json + if [ -s $repository-contributors.json ]; then + echo "Contributors found for $repository" + cat $repository-contributors.json + + jq --argjson newContributors "$(cat $repository-contributors.json)" \ + '.contributors["$repository"] |= (. + $newContributors) | + .contributors["$repository"] |= unique_by(.username)' \ + "contributors.json" > temp.json && mv temp.json "contributors.json" + + rm $repository-contributors.json + else + echo "No contributors for $repository" + fi + + done + + cat contributors.json - name: Use Node.js uses: actions/setup-node@v3 with: From babd0125260ba46410384a67f10dc66243c9a0f1 Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Sat, 24 Feb 2024 18:26:10 -1000 Subject: [PATCH 02/10] check if parseable JSON with jq --- .github/workflows/contributors.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index 7747b29..8a92ad2 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -62,7 +62,14 @@ jobs: for repository in ${repositories[@]} do echo "Collecting contributors for $repository" - curl -s https://raw.githubusercontent.com/CodeWithAloha/$repository/main/.all-contributorsrc | jq -r '.contributors[] | {username: .login, avatar_url: .avatar_url, url: .profile }' | jq -s . > $repository-contributors.json + curl -s https://raw.githubusercontent.com/CodeWithAloha/$repository/main/.all-contributorsrc > $repository-contributors.json + + if !jq -e . >/dev/null 2>&1 < $repository-contributors.json; then + echo "No contributors for $repository" + continue + fi + + echo $repository-contributors.json | jq -r '.contributors[] | {username: .login, avatar_url: .avatar_url, url: .profile }' | jq -s . > $repository-contributors.json if [ -s $repository-contributors.json ]; then echo "Contributors found for $repository" cat $repository-contributors.json From ef1bc0eeecb981bc0062395561d1db80c6c2446c Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Sat, 24 Feb 2024 18:30:25 -1000 Subject: [PATCH 03/10] try again --- .github/workflows/contributors.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index 8a92ad2..2e49c24 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -64,7 +64,7 @@ jobs: echo "Collecting contributors for $repository" curl -s https://raw.githubusercontent.com/CodeWithAloha/$repository/main/.all-contributorsrc > $repository-contributors.json - if !jq -e . >/dev/null 2>&1 < $repository-contributors.json; then + if !jq -e . >/dev/null 2>&1 <<< "$(cat $repository-contributors.json)"; then echo "No contributors for $repository" continue fi From 3659578ca865e340138432c5cda742d183bb5937 Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Sat, 24 Feb 2024 18:33:14 -1000 Subject: [PATCH 04/10] missing space --- .github/workflows/contributors.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index 2e49c24..22fca02 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -64,7 +64,7 @@ jobs: echo "Collecting contributors for $repository" curl -s https://raw.githubusercontent.com/CodeWithAloha/$repository/main/.all-contributorsrc > $repository-contributors.json - if !jq -e . >/dev/null 2>&1 <<< "$(cat $repository-contributors.json)"; then + if ! jq -e . >/dev/null 2>&1 <<< "$(cat $repository-contributors.json)"; then echo "No contributors for $repository" continue fi From 023c00d69a4ce41ce95d31e62b294ca305d432ea Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Sat, 24 Feb 2024 18:34:55 -1000 Subject: [PATCH 05/10] fixes --- .github/workflows/contributors.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index 22fca02..aa1edfb 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -66,10 +66,11 @@ jobs: if ! jq -e . >/dev/null 2>&1 <<< "$(cat $repository-contributors.json)"; then echo "No contributors for $repository" + rm $repository-contributors.json continue fi - echo $repository-contributors.json | jq -r '.contributors[] | {username: .login, avatar_url: .avatar_url, url: .profile }' | jq -s . > $repository-contributors.json + cat $repository-contributors.json | jq -r '.contributors[] | {username: .login, avatar_url: .avatar_url, url: .profile }' | jq -s . > $repository-contributors.json if [ -s $repository-contributors.json ]; then echo "Contributors found for $repository" cat $repository-contributors.json From f550ba766ea087a1bedc40da546f53956cab5ed5 Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Sat, 24 Feb 2024 18:37:49 -1000 Subject: [PATCH 06/10] debugging --- .github/workflows/contributors.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index aa1edfb..369c822 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -64,8 +64,10 @@ jobs: 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" + echo "No contributors for $repository, or .all-contributorsrc is not valid JSON" rm $repository-contributors.json continue fi From 2b434b9e2fe9423b96753294d808106fe02b1427 Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Sat, 24 Feb 2024 18:43:39 -1000 Subject: [PATCH 07/10] two separate files --- .github/workflows/contributors.yml | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index 369c822..df63b40 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -72,20 +72,18 @@ jobs: continue fi - cat $repository-contributors.json | jq -r '.contributors[] | {username: .login, avatar_url: .avatar_url, url: .profile }' | jq -s . > $repository-contributors.json - if [ -s $repository-contributors.json ]; then - echo "Contributors found for $repository" - cat $repository-contributors.json + 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-contributors.json)" \ - '.contributors["$repository"] |= (. + $newContributors) | - .contributors["$repository"] |= unique_by(.username)' \ - "contributors.json" > temp.json && mv temp.json "contributors.json" + jq --argjson newContributors "$(cat $repository-output.json)" \ + '.contributors["$repository"] |= (. + $newContributors) | + .contributors["$repository"] |= unique_by(.username)' \ + "contributors.json" > temp.json && mv temp.json "contributors.json" - rm $repository-contributors.json - else - echo "No contributors for $repository" - fi + rm $repository-contributors.json + rm $repository-output.json done From 6c2a61a3a76526dbe01f844ba12d518f41ab1f1e Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Sat, 24 Feb 2024 18:47:23 -1000 Subject: [PATCH 08/10] pass in variable with --arg to jq --- .github/workflows/contributors.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index df63b40..921a854 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -78,8 +78,9 @@ jobs: cat $repository-output.json jq --argjson newContributors "$(cat $repository-output.json)" \ - '.contributors["$repository"] |= (. + $newContributors) | - .contributors["$repository"] |= unique_by(.username)' \ + --arg repo "$repository" \ + '.contributors[$repo] |= (. + $newContributors) | + .contributors[$repo] |= unique_by(.username)' \ "contributors.json" > temp.json && mv temp.json "contributors.json" rm $repository-contributors.json From 4d1bb360a7e74561c3b5f5a6c0ffe123ddc6cbc4 Mon Sep 17 00:00:00 2001 From: Tyler Chong Date: Sat, 24 Feb 2024 18:52:50 -1000 Subject: [PATCH 09/10] ran prettier --- .github/workflows/contributors.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/contributors.yml b/.github/workflows/contributors.yml index 921a854..e4860b6 100644 --- a/.github/workflows/contributors.yml +++ b/.github/workflows/contributors.yml @@ -88,7 +88,7 @@ jobs: done - cat contributors.json + cat contributors.json - name: Use Node.js uses: actions/setup-node@v3 with: From c2edb427d6799ad650da71e97f9a6b8e9c821165 Mon Sep 17 00:00:00 2001 From: tyliec Date: Sun, 25 Feb 2024 04:53:52 +0000 Subject: [PATCH 10/10] [bot] Update contributors.json --- contributors.json | 74 ++++++++++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 27 deletions(-) diff --git a/contributors.json b/contributors.json index 7f0e70a..f317b9d 100644 --- a/contributors.json +++ b/contributors.json @@ -2,24 +2,14 @@ "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", @@ -27,9 +17,14 @@ "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", @@ -37,24 +32,44 @@ "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": [ @@ -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",