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
Add support for getting Repository when listing secret scanning alert…
…s for Enterprise

There is no easy way of getting the org/repo when listing secret scanning alerts for enterprise in the current struct. The API returns the Repository, and with this change it will be included in the SecretScanningAlert
  • Loading branch information
Emil Vaagland committed Jun 28, 2023
commit dc78e50c40a0e3c5f74b3fbf076ecc3b5ca6232a
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.

7 changes: 7 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.

23 changes: 12 additions & 11 deletions github/secret_scanning.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ type SecretScanningService service

// SecretScanningAlert represents a GitHub secret scanning alert.
type SecretScanningAlert struct {
Number *int `json:"number,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
URL *string `json:"url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
LocationsURL *string `json:"locations_url,omitempty"`
State *string `json:"state,omitempty"`
Resolution *string `json:"resolution,omitempty"`
ResolvedAt *Timestamp `json:"resolved_at,omitempty"`
ResolvedBy *User `json:"resolved_by,omitempty"`
SecretType *string `json:"secret_type,omitempty"`
Secret *string `json:"secret,omitempty"`
Number *int `json:"number,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
URL *string `json:"url,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
LocationsURL *string `json:"locations_url,omitempty"`
State *string `json:"state,omitempty"`
Resolution *string `json:"resolution,omitempty"`
ResolvedAt *Timestamp `json:"resolved_at,omitempty"`
ResolvedBy *User `json:"resolved_by,omitempty"`
SecretType *string `json:"secret_type,omitempty"`
Secret *string `json:"secret,omitempty"`
Repository *Repository `json:"repository,omitempty"`
}

// SecretScanningAlertLocation represents the location for a secret scanning alert.
Expand Down
12 changes: 11 additions & 1 deletion github/secret_scanning_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,12 @@ func TestSecretScanningService_ListAlertsForEnterprise(t *testing.T) {
"resolved_at": null,
"resolved_by": null,
"secret_type": "mailchimp_api_key",
"secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"
"secret": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2",
"repository": {
"id": 1,
"name": "n",
"url": "url"
}
}]`)
})

Expand All @@ -61,6 +66,11 @@ func TestSecretScanningService_ListAlertsForEnterprise(t *testing.T) {
ResolvedBy: nil,
SecretType: String("mailchimp_api_key"),
Secret: String("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX-us2"),
Repository: &Repository{
ID: Int64(1),
URL: String("url"),
Name: String("n"),
},
},
}

Expand Down