Skip to content

Commit

Permalink
check if parseable JSON with jq
Browse files Browse the repository at this point in the history
  • Loading branch information
tyliec committed Feb 25, 2024
1 parent 59e45c7 commit 7623359
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/contributors.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7623359

Please sign in to comment.