github-codebuild-logs
github-codebuild-logs copied to clipboard
Add optional HidePreviousComments option which defaults to false
Is your feature request related to a problem? Please describe. github-codebuild-logs posts multiple comments based on how many times CodeBuild was run for the PR, which depends on how many times additional pushes were done to PR branch after the PR was posted. Example https://github.com/aws/aws-sdk-js-v3/pull/824
Describe the solution you'd like
Add optional HidePreviousComments
option which is false by default. When true, it will hide previously posted PR comments as Outdated before posting a new one.
Describe alternatives you've considered
- Manually hide old comments from github-codebuild-logs as outdated, for example https://github.com/aws/aws-sdk-js-v3/pull/976
- Use
DeletePreviousComments
option, but it deletes the comments instead of hiding them
The option DeletePreviousComments
was added in https://github.com/jlhood/github-codebuild-logs/pull/21
PyGitHub revision 34d097ce doesn't have API to hide comment in IssueComment. Docs: https://pygithub.readthedocs.io/en/latest/github_objects/IssueComment.html
GitHub REST API v3 doesn't have an option to hide or minimize comment.
Alternative solution is to update comment and collapse the comment content as follows:
Outdated AWS CodeBuild CI Report
AWS CodeBuild CI Report
- CodeBuild project: PROJECT_NAME
- Commit ID: COMMIT_ID
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
Screenshot
Docs:
- PyGitHub https://pygithub.readthedocs.io/en/latest/github_objects/IssueComment.html#github.IssueComment.IssueComment.edit
- GitHub REST API v3 https://docs.github.com/en/free-pro-team@latest/rest/reference/issues#update-an-issue-comment
The GraphQL API provides minimizeComment option under Mutations. Docs: https://docs.github.com/en/free-pro-team@latest/graphql/reference/mutations#minimizecomment
Refs: https://github.com/isaacs/github/issues/1480
I think this project should be good with DeletePreviousComments
support, and this request can be closed.
@jlhood WDYT?
update comment
Instead of updating previous comments while still posting new comments, it's cleaner to just keep updating the same comment without posting new comments. With comment edit history easily accessible on Github, that balances clean threads with arbitrarily large numbers of previous reports