runatlantis / atlantis

Terraform Pull Request Automation
https://www.runatlantis.io
Other
7.68k stars 1.05k forks source link

Display issue with split atlantis comments in Github #2240

Open margueritepd opened 2 years ago

margueritepd commented 2 years ago

Community Note

Overview of the Issue

If the terraform plan is of precisely the right length, then when atlantis breaks it up into multiple comments for Github, the apply instructions which typically appear outside of the <details> element are actually hidden, because the </details> tag is added inside a code block.

Screen Shot 2022-05-02 at 10 46 29 AM

The raw markdown for the first comment can be seen here And the second comment here

Basically the assumption that the comment-splitting code makes, that the comment will be split inside a code block, is not holding true, and the addition of code block back-ticks where it doesn't belong is preventing the <details> tags from working correctly.

Environment details

We run atlantis with Github.

Additional Context

Comment splitting code: https://github.com/runatlantis/atlantis/blob/13fba408273ff8940120e5451f39715afd5d7891/server/events/vcs/github_client.go#L147-L170

jamengual commented 2 years ago

is this still happening with v0.19.8?

margueritepd commented 1 year ago

@jamengual I don't experience this regularly (the terraform output has to be exactly the right length) but the SplitComment and CreateComment code have not changed much since I posted this so I'm pretty sure it is still happening. As you can see the code blindly assumes that it must split the comment with

    ```</details>

which is only appropriate if the comment body already has an un-closed


at the point of splitting which is true most of the time but not always.
margueritepd commented 1 year ago

Can you remove the waiting-on-response label, since I have responded?

jamengual commented 1 year ago

@margueritepd willing to send a PR?