Skip to content

Truncate CDK diff PR comment when over GitHub's comment-length limit#135

Merged
aaronmedina-dev merged 2 commits intomainfrom
feature/do-2018_truncate-long-cdk-diff-pr-comment
Apr 20, 2026
Merged

Truncate CDK diff PR comment when over GitHub's comment-length limit#135
aaronmedina-dev merged 2 commits intomainfrom
feature/do-2018_truncate-long-cdk-diff-pr-comment

Conversation

@aaronmedina-dev
Copy link
Copy Markdown
Contributor

@aaronmedina-dev aaronmedina-dev commented Apr 20, 2026

Summary

  • When a CDK diff is very large (e.g. broad IAM pipeline changes that cascade across many stacks), the generated PR comment body exceeds GitHub's 65,536 character issue comment limit.
  • The Post diff to PR comment step then fails with Body is too long (maximum is 65536 characters), marking the whole CDK job red even though the diff was produced successfully.
  • Fix: when the body exceeds a safe limit (60,000 chars) the inline diff is truncated and a notice linking to the workflow run artifacts is included. The full diff is already uploaded as deployment-diff-<stack> by the prior step, so no information is lost.

Context

image

When a CDK diff is very large (e.g. broad IAM pipeline changes), the
generated PR comment body exceeds GitHub's 65536-character issue
comment limit, and the Post diff to PR comment step fails with
'Body is too long'.

The full diff is already uploaded as a workflow artifact, so when
the comment body exceeds the safe limit it is now truncated and
a notice linking to the workflow run artifacts is included instead
of failing the job.
@aaronmedina-dev aaronmedina-dev merged commit 52683af into main Apr 20, 2026
3 checks passed
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.

2 participants