Skip to content

feat: Support resolution_comment to update alert API #3357

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

Merged
merged 3 commits into from
Dec 10, 2024

Conversation

na-ga
Copy link
Contributor

@na-ga na-ga commented Nov 25, 2024

Support to an optional comment when closing an alert

Per the documentation available here:
https://docs.github.com/en/rest/secret-scanning/secret-scanning?apiVersion=2022-11-28#update-a-secret-scanning-alert

@na-ga na-ga force-pushed the feat/add-resolution-comment branch from 3eab4a9 to a7ba2e5 Compare November 25, 2024 11:41

// An optional comment when closing an alert.
// Cannot be updated or deleted.
// Must be null when changing state to open.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I copied the comment from the documentation.
https://docs.github.com/en/rest/secret-scanning/secret-scanning?apiVersion=2022-11-28#update-a-secret-scanning-alert

However, I have now confirmed that comments can be added when changing to Open,
so this comment may not be necessary.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From reading the documentation, I'm a bit concerned about both the Resolution and now ResolutionComment fields because it says the fields are required in certain circumstances, and must be null in some specific cases. However, as written (with the omitempty), this repo will currently be unable to send null for either one of these fields, as the field will simply be omitted.

From your testing, @na-ga, is this a concern of yours?
Or do you wish to proceed as-is?

Copy link
Contributor Author

@na-ga na-ga Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me, it is better to be able to specify comments when changing to close state or open state.

When changing to open state, I think the comment should also be modified to match the actual behavior that can be specified as optional.

Therefore, how about removing the comment Cannot be updated or deleted. Must be null when changing state to open.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me.

@gmlewis gmlewis changed the title feat: support resolution_comment to update alert api feat: Support resolution_comment to update alert API Nov 26, 2024
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @na-ga and @Alexizx00789999 .
LGTM.
Merging.

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.30%. Comparing base (2b8c7fa) to head (b1af1ef).
Report is 191 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3357      +/-   ##
==========================================
- Coverage   97.72%   92.30%   -5.42%     
==========================================
  Files         153      176      +23     
  Lines       13390    15031    +1641     
==========================================
+ Hits        13085    13874     +789     
- Misses        215     1064     +849     
- Partials       90       93       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gmlewis gmlewis merged commit 077cefe into google:master Dec 10, 2024
6 of 7 checks passed
@na-ga na-ga deleted the feat/add-resolution-comment branch December 11, 2024 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants