+
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions github/secret_scanning.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ type SecretScanningAlertUpdateOptions struct {
// Required when the state is "resolved" and represents the reason for resolving the alert.
// Can be one of: "false_positive", "wont_fix", "revoked", or "used_in_tests".
Resolution *string `json:"resolution,omitempty"`

// An optional comment when closing an alert.
ResolutionComment *string `json:"resolution_comment,omitempty"`
}

// ListAlertsForEnterprise lists secret scanning alerts for eligible repositories in an enterprise, from newest to oldest.
Expand Down
28 changes: 15 additions & 13 deletions github/secret_scanning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ func TestSecretScanningService_UpdateAlert(t *testing.T) {
v := new(SecretScanningAlertUpdateOptions)
assertNilError(t, json.NewDecoder(r.Body).Decode(v))

want := &SecretScanningAlertUpdateOptions{State: "resolved", Resolution: String("used_in_tests")}
want := &SecretScanningAlertUpdateOptions{State: "resolved", Resolution: String("used_in_tests"), ResolutionComment: String("resolution comment")}

if !cmp.Equal(v, want) {
t.Errorf("Request body = %+v, want %+v", v, want)
Expand All @@ -373,6 +373,7 @@ func TestSecretScanningService_UpdateAlert(t *testing.T) {
"locations_url": "https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations",
"state": "resolved",
"resolution": "used_in_tests",
"resolution_comment": "resolution comment",
"resolved_at": "1996-06-20T00:00:00Z",
"resolved_by": null,
"secret_type": "mailchimp_api_key",
Expand All @@ -381,7 +382,7 @@ func TestSecretScanningService_UpdateAlert(t *testing.T) {
})

ctx := context.Background()
opts := &SecretScanningAlertUpdateOptions{State: "resolved", Resolution: String("used_in_tests")}
opts := &SecretScanningAlertUpdateOptions{State: "resolved", Resolution: String("used_in_tests"), ResolutionComment: String("resolution comment")}

alert, _, err := client.SecretScanning.UpdateAlert(ctx, "o", "r", 1, opts)
if err != nil {
Expand All @@ -390,17 +391,18 @@ func TestSecretScanningService_UpdateAlert(t *testing.T) {

date := Timestamp{time.Date(1996, time.June, 20, 00, 00, 00, 0, time.UTC)}
want := &SecretScanningAlert{
Number: Int(1),
CreatedAt: &date,
URL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1"),
HTMLURL: String("https://github.com/o/r/security/secret-scanning/1"),
LocationsURL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"),
State: String("resolved"),
Resolution: String("used_in_tests"),
ResolvedAt: &date,
ResolvedBy: nil,
SecretType: String("mailchimp_api_key"),
Secret: String("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"),
Number: Int(1),
CreatedAt: &date,
URL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1"),
HTMLURL: String("https://github.com/o/r/security/secret-scanning/1"),
LocationsURL: String("https://api.github.com/repos/o/r/secret-scanning/alerts/1/locations"),
State: String("resolved"),
Resolution: String("used_in_tests"),
ResolutionComment: String("resolution comment"),
ResolvedAt: &date,
ResolvedBy: nil,
SecretType: String("mailchimp_api_key"),
Secret: String("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"),
}

if !cmp.Equal(alert, want) {
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载