Skip to content

Truncate PR comment to fit GitHub's character limit - #21

Merged
OliverRC merged 1 commit into
mainfrom
fix/pr-comment-length
Oct 9, 2026
Merged

OliverRC merged 1 commit into
mainfrom
fix/pr-comment-length

Conversation

@OliverRC

@OliverRC OliverRC commented Oct 9, 2026

Copy link
Copy Markdown
Owner

Why

wootware/magento-1#225 removes the legacy Sendy install, which is 1,224 file deletions. The kickflip PR-comment step failed with:

Octokit.ApiValidationException: Validation Failed
Body is too long (maximum is 65536 characters)

The changes table has one row per file, and ConsoleTable pads every row to the widest path (about 290 characters here). That puts the comment at roughly 350k characters. Any large deployment will hit this.

Change

PullRequestCommentComposer.Compose now checks the full body length. If it's over 65,000 characters (some headroom under GitHub's 65,536), it:

  • cuts this action's section at the last full line that fits, so the markdown table still renders with complete rows
  • adds a note giving the original size and pointing to the workflow logs and job summary, which still list every change
  • leaves other actions' sections in the shared comment unchanged

I kept the per-row padding as is. Trimming it would save characters, but 1,224 rows still wouldn't fit, so truncation is needed regardless.

Testing

  • New test Compose_OversizedSection_TruncatesAtLineAndKeepsOtherSections: it checks that a 2,000-row section is truncated under the limit, the other section survives, the first rows are kept, the last rows are dropped, and every remaining table row is complete.
  • All 65 tests pass locally.

magento-1 installs kickflip from NuGet without a pinned version, so once this is released, re-running the magento-1 job will pick up the fix.

🤖 Generated with Claude Code

Large deployments (e.g. 1224 deleted files) produced a changes table far
over GitHub's comment limit, failing the run with 'Body is too long'.
Cut the action's section at a row boundary and point to the logs/job
summary for the full list.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@OliverRC
OliverRC merged commit e5654cd into main Oct 9, 2026
1 check passed
@OliverRC
OliverRC deleted the fix/pr-comment-length branch October 9, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant