@@ -111,11 +111,23 @@ jobs:
111111 echo "vale_count=$VALE_COUNT" >> "$GITHUB_OUTPUT"
112112
113113 if [ "$VALE_COUNT" -gt 0 ]; then
114- echo "Posting $VALE_COUNT Vale inline comments"
115- # Post as a PR review with inline comments
114+ MAX_INLINE=25
115+ INLINE_COMMENTS=$(echo "$COMMENTS_JSON" | jq ".[:$MAX_INLINE]")
116+ OVERFLOW=$((VALE_COUNT - MAX_INLINE))
117+ if [ "$OVERFLOW" -lt 0 ]; then OVERFLOW=0; fi
118+
119+ if [ "$OVERFLOW" -gt 0 ]; then
120+ OVERFLOW_MD=$(echo "$COMMENTS_JSON" | jq -r ".[$MAX_INLINE:][] | \"- **\(.path)** line \(.line): \(.body)\"")
121+ REVIEW_BODY=$(printf "**Vale found %d issue(s).** First %d shown as inline comments.\n\n<details>\n<summary>%d more issue(s)</summary>\n\n%s\n\n</details>" \
122+ "$VALE_COUNT" "$MAX_INLINE" "$OVERFLOW" "$OVERFLOW_MD")
123+ else
124+ REVIEW_BODY="**Vale found ${VALE_COUNT} issue(s).** See inline comments below."
125+ fi
126+
127+ echo "Posting $VALE_COUNT Vale issues ($MAX_INLINE inline, $OVERFLOW overflow)"
116128 jq -n \
117- --arg body "**Vale found ${VALE_COUNT} issue(s).** See inline comments below. " \
118- --argjson comments "$COMMENTS_JSON " \
129+ --arg body "$REVIEW_BODY " \
130+ --argjson comments "$INLINE_COMMENTS " \
119131 '{"body": $body, "event": "COMMENT", "comments": $comments}' \
120132 | gh api repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews \
121133 --input - 2>&1
@@ -411,10 +423,23 @@ jobs:
411423 done <<< "$CHANGED_MD_FILES"
412424
413425 if [ "$VALE_COUNT" -gt 0 ]; then
414- echo "Vale still found $VALE_COUNT issue(s) after fixes"
426+ MAX_INLINE=25
427+ INLINE_COMMENTS=$(echo "$COMMENTS_JSON" | jq ".[:$MAX_INLINE]")
428+ OVERFLOW=$((VALE_COUNT - MAX_INLINE))
429+ if [ "$OVERFLOW" -lt 0 ]; then OVERFLOW=0; fi
430+
431+ if [ "$OVERFLOW" -gt 0 ]; then
432+ OVERFLOW_MD=$(echo "$COMMENTS_JSON" | jq -r ".[$MAX_INLINE:][] | \"- **\(.path)** line \(.line): \(.body)\"")
433+ REVIEW_BODY=$(printf "**Vale found %d remaining issue(s) after fixes.** First %d shown as inline comments.\n\n<details>\n<summary>%d more issue(s)</summary>\n\n%s\n\n</details>" \
434+ "$VALE_COUNT" "$MAX_INLINE" "$OVERFLOW" "$OVERFLOW_MD")
435+ else
436+ REVIEW_BODY="**Vale found ${VALE_COUNT} remaining issue(s) after fixes.** See inline comments below."
437+ fi
438+
439+ echo "Vale still found $VALE_COUNT issue(s) after fixes ($MAX_INLINE inline, $OVERFLOW overflow)"
415440 jq -n \
416- --arg body "**Vale found ${VALE_COUNT} remaining issue(s) after fixes.** See inline comments below. " \
417- --argjson comments "$COMMENTS_JSON " \
441+ --arg body "$REVIEW_BODY " \
442+ --argjson comments "$INLINE_COMMENTS " \
418443 '{"body": $body, "event": "COMMENT", "comments": $comments}' \
419444 | gh api repos/${REPO}/pulls/${PR_NUMBER}/reviews --input - 2>&1
420445 else
0 commit comments