fix: different way to loop
This commit is contained in:
@@ -25,26 +25,29 @@ jobs:
|
||||
PAGE=1
|
||||
TOTAL_NAMES=0
|
||||
|
||||
while :; do
|
||||
while true; do
|
||||
echo "Fetching 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)
|
||||
PAGE_NAMES=$(echo "$RESP" | grep -o "\"name\":\"patrick\"" | wc -l || echo 0)
|
||||
|
||||
[ "$PAGE_NAMES" -eq 0 ] && break
|
||||
if [ "$PAGE_NAMES" -eq 0 ]; then
|
||||
echo "No more commits found for user 'patrick' on page $PAGE."
|
||||
break
|
||||
fi
|
||||
|
||||
TOTAL_NAMES=$((TOTAL_NAMES + PAGE_NAMES))
|
||||
echo "Found $PAGE_NAMES name matches on page $PAGE. Total so far: $TOTAL_NAMES"
|
||||
echo "Found $PAGE_NAMES name matches on page $PAGE. Total matches: $TOTAL_NAMES"
|
||||
|
||||
PAGE=$((PAGE + 1))
|
||||
|
||||
[ "$PAGE" -gt 100 ] && break
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user