File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 9494 NUM_STARS=$(curl -s $API_URL | jq '.stargazers_count // 0')
9595 NUM_CONTRIBUTORS=$(curl -s -I "${API_URL}/contributors?per_page=1" | grep -i 'link:' | sed -E 's/.*page=([0-9]+)>; rel="last".*/\1/')
9696
97+ # Get number of contributors, handle the case where pagination info might not be present (less than 30 contributors)
98+ CONTRIBUTORS_LINK_HEADER=$(curl -s -I "${API_URL}/contributors?per_page=1" | grep -i 'link:')
99+ if [ -z "$CONTRIBUTORS_LINK_HEADER" ]; then
100+ NUM_CONTRIBUTORS=$(curl -s "${API_URL}/contributors" | jq 'length')
101+ else
102+ NUM_CONTRIBUTORS=$(echo "$CONTRIBUTORS_LINK_HEADER" | sed -E 's/.*page=([0-9]+)>; rel="last".*/\1/' || echo "1")
103+ fi
104+
97105 echo "| Attribute | Value |"
98106 echo "| ----------------- | ----- |"
99107 echo "| Repository URL | $REPO_URL |"
You can’t perform that action at this time.
0 commit comments