fix: check for pages with no user commits

This commit is contained in:
gitea-analytics-bot
2026-01-21 21:53:33 -05:00
parent 0819ee888b
commit c254bbf08a

View File

@@ -26,30 +26,29 @@ jobs:
TOTAL_NAMES=0
while true; do
echo "Fetching page $PAGE..."
echo "Requesting Page $PAGE..."
URL="http://gitea-http:3000/api/v1/repos/${{ github.repository }}/commits?since=${SINCE_DATE}&page=${PAGE}&limit=50"
RESP=$(wget -qO- --header="Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$URL")
PAGE_NAMES=$(echo "$RESP" | grep -o "\"name\":\"patrick\"" | wc -l || echo 0)
if [ "$PAGE_NAMES" -eq 0 ]; then
echo "No more commits found for user 'patrick' on page $PAGE."
if [ "$RESP" = "[]" ] || [ -z "$RESP" ]; then
echo "Reached the end of history at page $PAGE."
break
fi
TOTAL_NAMES=$((TOTAL_NAMES + PAGE_NAMES))
echo "Found $PAGE_NAMES name matches on page $PAGE. Total matches: $TOTAL_NAMES"
PAGE_NAMES=$(echo "$RESP" | grep -o "\"name\":\"patrick\"" | wc -l || echo 0)
echo "Page $PAGE: Found $PAGE_NAMES name matches."
TOTAL_NAMES=$((TOTAL_NAMES + PAGE_NAMES))
PAGE=$((PAGE + 1))
if [ "$PAGE" -gt 100 ]; then break; fi
done
# Final calculation
RAW_COUNT=$((TOTAL_NAMES / 2))
echo "Final Human Count: $RAW_COUNT"
echo "COMMIT_VELOCITY=$RAW_COUNT" >> $GITHUB_ENV
echo "Final tally for Patrick: $RAW_COUNT"
- name: Update README
env: