Skip to content

feat(secret scanning): Support pull_request_comment_url #3344

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 1 commit into from
Nov 6, 2024

Conversation

chrisallenlane
Copy link
Contributor

@chrisallenlane chrisallenlane commented Nov 6, 2024

Modify SecretScanningAlertLocationDetails to recognize API responses of type pull_request_comment_url.

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

For requests to this route:

curl -L \
  -H "Accept: application/vnd.github+json" \
  -H "Authorization: Bearer <YOUR-TOKEN>" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  https://api.github.com/repos/OWNER/REPO/secret-scanning/alerts/ALERT_NUMBER/locations

The API may return JSON that matches the following shape:

// ...
  {
  "type": "pull_request_comment",
  "details": {
    "pull_request_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments/1825855898"
  }
},
// ...

(I'm sorry I can't provide a more specific link. The docs don't make one available.)

Previously, go-github would not expose that data to the user. This change makes it available by adding a new field (PullRequestCommentURL) to the SecretScanningAlertLocationDetails struct.

Tests are included.

Modify `SecretScanningAlertLocationDetails` to recognize API responses
of type `pull_request_comment_url`.
Copy link

google-cla bot commented Nov 6, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@chrisallenlane
Copy link
Contributor Author

If someone is able to re-run the cla/google check, I have signed the CLA. Thanks.

@gmlewis gmlewis changed the title feat(secret scanning): support pull_request_comment_url feat(secret scanning): Support pull_request_comment_url Nov 6, 2024
Copy link

codecov bot commented Nov 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.30%. Comparing base (2b8c7fa) to head (4a031cd).
Report is 166 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3344      +/-   ##
==========================================
- 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.

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, @chrisallenlane !
LGTM.
Merging.

@gmlewis gmlewis merged commit 1f5fe3c into google:master Nov 6, 2024
6 of 7 checks passed
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