Skip to content

Commit

Permalink
Fetch participants.tsv and participants.json
Browse files Browse the repository at this point in the history
  • Loading branch information
rmanaem committed Aug 27, 2024
1 parent 7a1f278 commit e4c4242
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion scripts/fetch-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ while true; do
for REPO_NAME in $REPO_NAMES; do
JSONLD_FILE="${REPO_NAME}.jsonld"
ANNOTATED=false
TSV_EXISTS=false
JSON_EXISTS=false

# Fetch the contents of the annotations repository
FILE_RESPONSE=$(curl -s -H "Authorization: token $GH_TOKEN" "https://api.github.com/repos/$ANNOTATIONS_REPO/contents/${JSONLD_FILE}")
Expand All @@ -57,8 +59,20 @@ while true; do
ANNOTATED=true
fi

# Check for participants.tsv in the repository
TSV_RESPONSE=$(curl -s -H "Authorization: token $GH_TOKEN" "https://api.github.com/repos/$ORG/$REPO_NAME/contents/participants.tsv")
if echo "$TSV_RESPONSE" | jq -e '.name // empty' >/dev/null 2>&1; then
TSV_EXISTS=true
fi

# Check for participants.json in the repository
JSON_RESPONSE=$(curl -s -H "Authorization: token $GH_TOKEN" "https://api.github.com/repos/$ORG/$REPO_NAME/contents/participants.json")
if echo "$JSON_RESPONSE" | jq -e '.name // empty' >/dev/null 2>&1; then
JSON_EXISTS=true
fi

# Add the repository information to the array
REPOS+=("{\"name\": \"$REPO_NAME\", \"annotated\": $ANNOTATED}")
REPOS+=("{\"name\": \"$REPO_NAME\", \"annotated\": $ANNOTATED, \"participants.tsv\": $TSV_EXISTS, \"participants.json\": $JSON_EXISTS}")
done

# Increment page number
Expand Down

0 comments on commit e4c4242

Please sign in to comment.