-
Notifications
You must be signed in to change notification settings - Fork 197
Description
Feature Request
Problem Statement
The current github.pullRequestComment notification in argoproj/notifications-engine provides a commentTag option to identify and upsert comments on PRs. However, this comes with two significant limitations:
-
No comment folding/collapsing support: When not using
commentTag, or even when using it, there is no native way to mark a comment as minimized/outdated. Tools likemarocchino/sticky-pull-request-commentexpose options such ashide: true,hide_and_recreate: true, andhide_classifyto minimize old comments via GitHub's API. No equivalent exists innotifications-engine. -
commentTagis not templateable: ThecommentTagfield value is used as a static string (it is not rendered through the Go template engine). This means that when multiple Argo CD Applications are associated with the same PR, they all share the samecommentTag, causing their comments to override each other — only the last notification "wins". There is currently no way to include dynamic values (e.g., the application name) in the tag to make it unique per Application.
Current Behavior
GitHubPullRequestComment.CommentTagis a static string set once at template definition time (pkg/services/github.go).- When a
commentTagis provided, the engine searches for a comment containing<!-- argocd-notifications <tag> -->and updates it in-place, or creates a new one. - Old/stale comments are never hidden or minimized.
- No mechanism exists to differentiate comments from multiple Applications on the same PR.
Proposed Solutions
1. Make commentTag templateable
Allow the commentTag field to support Go template expressions, similar to how content, repoURLPath, and revisionPath already do. This would allow users to include dynamic values to avoid per-application collisions:
pullRequestComment:
content: |
Application {{.app.metadata.name}} sync status: {{.app.status.sync.status}}
commentTag: "{{.app.metadata.name}}"This would generate a unique hidden HTML tag per Application, e.g.:
<!-- argocd-notifications my-app -->
...preventing different Applications from overwriting each other's comments.
2. Add comment folding/minimization options
Introduce new optional fields on GitHubPullRequestComment inspired by marocchino/sticky-pull-request-comment, such as:
| New field | Type | Description |
|---|---|---|
hide |
bool |
Minimize the previous comment before creating a new one |
hideAndRecreate |
bool |
Minimize old comment and post a new comment at the bottom |
hideClassify |
string |
Reason for minimizing (e.g., OUTDATED, RESOLVED) |
Example usage:
pullRequestComment:
content: |
App {{.app.metadata.name}} deployed to {{.app.spec.destination.namespace}}
commentTag: "{{.app.metadata.name}}"
hideAndRecreate: true
hideClassify: "OUTDATED"This requires using GitHub's GraphQL API minimizeComment mutation, as the REST API does not support minimizing comments.
Why This Matters
In monorepo or multi-app setups, multiple Argo CD Applications may target the same Git repository and therefore the same PR. Without a templateable commentTag or per-app differentiation, notifications from different Applications overwrite each other, making PR comments unreliable. Adding folding support also improves the signal-to-noise ratio on busy PRs by collapsing outdated statuses.
References
marocchino/sticky-pull-request-comment— inspiration forhide,hide_and_recreate,hide_classifyoptions- GitHub GraphQL API:
minimizeCommentmutation - Current implementation:
pkg/services/github.go - Current docs:
docs/services/github.md