-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add basic pull request comment alert type #5133
Conversation
e1028d3
to
d0bec61
Compare
internal/engine/actions/alert/pull_request_comment/pull_request_comment.go
Fixed
Show resolved
Hide resolved
d0bec61
to
fb980a2
Compare
Number int | ||
Metadata *alertMetadata | ||
prevStatus *db.ListRuleEvaluationsByProfileIdRow | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, so... If I understand correctly, this are the parameters to create a PR regardless of the underlying driver, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's right
internal/engine/actions/alert/pull_request_comment/pull_request_comment.go
Outdated
Show resolved
Hide resolved
return nil, fmt.Errorf("no PR comment ID provided: %w", enginerr.ErrActionTurnedOff) | ||
} | ||
|
||
_, err := alert.gh.DismissReview(ctx, params.Owner, params.Repo, params.Number, *params.Metadata.ReviewID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do I read this correctly that the ReviewID is what would differentiate alerts/reviews between different ruletypes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because at this point we do one review/comment per ruletype. Once we combine all Minder comments into a single review, then we will only have one reviewId per entity
fb980a2
to
4149117
Compare
Summary
This adds a very basic pull request comment alert type.
When an evaluation fails and alerts are enabled, this alert type will comment on a PR.
This does not include line comments, only a single review comment, which is hardcoded in the ruletype definition.
Ref #5117
See "Testing" below for instruction on how to try it.
Change Type
Mark the type of change your PR introduces:
Testing
This is still a work in progress, but the happy path works.
pull_request_review
as the alert type, for example:Trigger an evaluation failure, in this case I created a PR that adds mixed scripts, see Add mixed scripts eleftherias/demo-repo-go#10
Minder will comment on the PR with the message set in the ruletype definition
Review Checklist: