openshift-helm-charts / development

0 stars 17 forks source link

Improve markdown comment formatting library and update PR comment format #283

Closed komish closed 10 months ago

komish commented 10 months ago

This is the first PR in an effort to restructure how we handle PR comments so it's a bit more reliable in our pipeline. This PR mostly just cleans up the library logic, and produces a formatted PR comment.

We currently don't have a templating dependency like Jinja, so I continued to leave any templating dependency out. For now. That might change in the future.

With that said, this PR adds helper functionality append_to that helps build the comment, and consolidates our use of multi-line strings (which visually breaks the flow of the source code), and manually managed line breaks to as few places as possible.

This PR also adds a 'Task Table' to the PR comment, which reflects what GitHub Action steps were considered in the production of the comment. We could make this more useful over time. Admittedly, this is mostly useful for us as maintainers, to review what broke at a glance.

Finally, I've added comments to clarify intent in the functionality, and have added print statements to allow us to review the generated comment in CI should it not get posted to the PR itself (for any reason, like GHA outages).

komish commented 10 months ago

Note to reviewers: A lot of the work here was cleaning up how the library worked, but note that the PR comments now look different, and that's somewhat transparent. Click through the PRs CI made to see what I mean.