Use "concise" diff comment in cases "regular" diff comment is > 65536 #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces several improvements to the handling and logging of ArgoCD diff comments, including the addition of a concise template for large comments, and refactoring of error logging. The most important changes include defining a constant for the maximum GitHub comment size, adding logic to handle large diff comments, and creating a concise template for such comments.
Improvements to handling large diff comments:
internal/pkg/githubapi/github.go
: Defined a new constantgithubCommentMaxSize
to specify the maximum size of GitHub comments.internal/pkg/githubapi/github.go
: Added logic to check the size of the generated diff comment and switch to a concise template if the comment is too large.Enhancements to logging:
internal/pkg/githubapi/github.go
: Refactored error logging to useghPrClientDetails.PrLogger
instead of the globallog
object for more consistent and contextual logging.New concise template:
templates/argoCD-diff-pr-comment-concise.gotmpl
: Created a new concise template for ArgoCD diff comments that are too large to fit within the GitHub comment size limit.Please provide a meaningful description of what this change will do, or is for. Bonus points for including links to related issues, other PRs, or technical references.
Example of concise image:
Type of Change
Checklist