Skip to content

Commit

Permalink
Add Repository struct to SecretScanningAlert (#2823)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilva authored Jun 28, 2023
1 parent 96726d8 commit 7a8ab98
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 12 deletions.
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

0 comments on commit 7a8ab98

Please sign in to comment.