Skip to content

TF Plan output to comment on a PR fails | body is too long (maximum is 65536 characters) #150

@Gaurav2Github

Description

@Gaurav2Github

Description

I am receiving validation error as below when plan has more than 65536 chars.
This occurs when the action tries to add new/update comment after a successful plan on the PR.

Error: Validation Failed: {"resource":"IssueComment","code":"custom","field":"body","message":"body is too long (maximum is 65536 characters)"}

It seems that this 65536 chars is a hard limit https://github.com/orgs/community/discussions/41331 on the Github api.

To mitigate this issue, we should look at trimming the output before trying to add comment or split comments on the PR. Any other suggestion are welcome.

GitHub Action Version

v3.0.3

Configuration

terraformVersion: 1.5.7
cdktfVersion: 0.18.0
stackName: my-tf-stack
mode: plan-only
terraformCloudToken: ${{ secrets.TF_API_TOKEN }}
githubToken: ${{ secrets.GITHUB_TOKEN }}

Gist

No response

Possible Solutions

Trim messageWithTag to first 65536 characters before executing
octokit.rest.issues.createComment or octokit.rest.issues.updateComment

Workarounds

Immediate resolution would be to set commentOnPr and updateComment parameters to false temporarily.

Anything Else?

No response

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnewA new issue or feature request that has not yet been triaged by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions