github-codebuild-logs icon indicating copy to clipboard operation
github-codebuild-logs copied to clipboard

Add optional HidePreviousComments option which defaults to false

Open trivikr opened this issue 4 years ago • 5 comments

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

trivikr avatar Mar 16 '20 16:03 trivikr

The option DeletePreviousComments was added in https://github.com/jlhood/github-codebuild-logs/pull/21

trivikr avatar Jan 05 '21 21:01 trivikr

PyGitHub revision 34d097ce doesn't have API to hide comment in IssueComment. Docs: https://pygithub.readthedocs.io/en/latest/github_objects/IssueComment.html

trivikr avatar Jan 05 '21 21:01 trivikr

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

Screen Shot 2021-01-05 at 1 31 05 PM

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

trivikr avatar Jan 05 '21 21:01 trivikr

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?

trivikr avatar Jan 05 '21 21:01 trivikr

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

PatMyron avatar May 07 '23 04:05 PatMyron