From ccb1e49633d5ef746f4de1520433ec381c84cf90 Mon Sep 17 00:00:00 2001 From: Matt Fleury Date: Thu, 24 Jul 2025 12:37:02 -0400 Subject: [PATCH 1/2] adding new location info --- github/github-accessors.go | 16 ++++++++++ github/github-accessors_test.go | 19 ++++++++++++ github/secret_scanning.go | 54 +++++++++++++++++---------------- 3 files changed, 63 insertions(+), 26 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 6a08cd8fd91..a126d8d1051 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -24830,6 +24830,22 @@ func (s *SecretScanningAlert) GetCreatedAt() Timestamp { return *s.CreatedAt } +// GetFirstLocation returns the FirstLocation field. +func (s *SecretScanningAlert) GetFirstLocation() *SecretScanningAlertLocationDetails { + if s == nil { + return nil + } + return s.FirstLocation +} + +// GetHasMoreLocations returns the HasMoreLocations field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetHasMoreLocations() bool { + if s == nil || s.HasMoreLocations == nil { + return false + } + return *s.HasMoreLocations +} + // GetHTMLURL returns the HTMLURL field if it's non-nil, zero value otherwise. func (s *SecretScanningAlert) GetHTMLURL() string { if s == nil || s.HTMLURL == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 19088ff6356..2d882e65367 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -31980,6 +31980,25 @@ func TestSecretScanningAlert_GetCreatedAt(tt *testing.T) { s.GetCreatedAt() } +func TestSecretScanningAlert_GetFirstLocation(tt *testing.T) { + tt.Parallel() + s := &SecretScanningAlert{} + s.GetFirstLocation() + s = nil + s.GetFirstLocation() +} + +func TestSecretScanningAlert_GetHasMoreLocations(tt *testing.T) { + tt.Parallel() + var zeroValue bool + s := &SecretScanningAlert{HasMoreLocations: &zeroValue} + s.GetHasMoreLocations() + s = &SecretScanningAlert{} + s.GetHasMoreLocations() + s = nil + s.GetHasMoreLocations() +} + func TestSecretScanningAlert_GetHTMLURL(tt *testing.T) { tt.Parallel() var zeroValue string diff --git a/github/secret_scanning.go b/github/secret_scanning.go index ad2312d0b2c..6b5d587431c 100644 --- a/github/secret_scanning.go +++ b/github/secret_scanning.go @@ -16,32 +16,34 @@ 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"` - SecretTypeDisplayName *string `json:"secret_type_display_name,omitempty"` - Secret *string `json:"secret,omitempty"` - Repository *Repository `json:"repository,omitempty"` - UpdatedAt *Timestamp `json:"updated_at,omitempty"` - IsBase64Encoded *bool `json:"is_base64_encoded,omitempty"` - MultiRepo *bool `json:"multi_repo,omitempty"` - PubliclyLeaked *bool `json:"publicly_leaked,omitempty"` - PushProtectionBypassed *bool `json:"push_protection_bypassed,omitempty"` - PushProtectionBypassedBy *User `json:"push_protection_bypassed_by,omitempty"` - PushProtectionBypassedAt *Timestamp `json:"push_protection_bypassed_at,omitempty"` - ResolutionComment *string `json:"resolution_comment,omitempty"` - PushProtectionBypassRequestComment *string `json:"push_protection_bypass_request_comment,omitempty"` - PushProtectionBypassRequestHTMLURL *string `json:"push_protection_bypass_request_html_url,omitempty"` - PushProtectionBypassRequestReviewer *User `json:"push_protection_bypass_request_reviewer,omitempty"` - PushProtectionBypassRequestReviewerComment *string `json:"push_protection_bypass_request_reviewer_comment,omitempty"` - Validity *string `json:"validity,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"` + FirstLocation *SecretScanningAlertLocationDetails `json:"first_location_detected,omitempty"` + HasMoreLocations *bool `json:"has_more_locations,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"` + SecretTypeDisplayName *string `json:"secret_type_display_name,omitempty"` + Secret *string `json:"secret,omitempty"` + Repository *Repository `json:"repository,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` + IsBase64Encoded *bool `json:"is_base64_encoded,omitempty"` + MultiRepo *bool `json:"multi_repo,omitempty"` + PubliclyLeaked *bool `json:"publicly_leaked,omitempty"` + PushProtectionBypassed *bool `json:"push_protection_bypassed,omitempty"` + PushProtectionBypassedBy *User `json:"push_protection_bypassed_by,omitempty"` + PushProtectionBypassedAt *Timestamp `json:"push_protection_bypassed_at,omitempty"` + ResolutionComment *string `json:"resolution_comment,omitempty"` + PushProtectionBypassRequestComment *string `json:"push_protection_bypass_request_comment,omitempty"` + PushProtectionBypassRequestHTMLURL *string `json:"push_protection_bypass_request_html_url,omitempty"` + PushProtectionBypassRequestReviewer *User `json:"push_protection_bypass_request_reviewer,omitempty"` + PushProtectionBypassRequestReviewerComment *string `json:"push_protection_bypass_request_reviewer_comment,omitempty"` + Validity *string `json:"validity,omitempty"` } // SecretScanningAlertLocation represents the location for a secret scanning alert. From dad7a0639b16c4d2cd9dfc2c475e2786591b0ec9 Mon Sep 17 00:00:00 2001 From: Matt Fleury Date: Thu, 24 Jul 2025 13:40:47 -0400 Subject: [PATCH 2/2] updates from PR, use same name as API --- github/github-accessors.go | 6 +++--- github/github-accessors_test.go | 6 +++--- github/secret_scanning.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 96db1c8e6b5..b9d8bcf7e65 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -24902,12 +24902,12 @@ func (s *SecretScanningAlert) GetCreatedAt() Timestamp { return *s.CreatedAt } -// GetFirstLocation returns the FirstLocation field. -func (s *SecretScanningAlert) GetFirstLocation() *SecretScanningAlertLocationDetails { +// GetFirstLocationDetected returns the FirstLocationDetected field. +func (s *SecretScanningAlert) GetFirstLocationDetected() *SecretScanningAlertLocationDetails { if s == nil { return nil } - return s.FirstLocation + return s.FirstLocationDetected } // GetHasMoreLocations returns the HasMoreLocations field if it's non-nil, zero value otherwise. diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index d2397412067..f6a191ee0f8 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -32079,12 +32079,12 @@ func TestSecretScanningAlert_GetCreatedAt(tt *testing.T) { s.GetCreatedAt() } -func TestSecretScanningAlert_GetFirstLocation(tt *testing.T) { +func TestSecretScanningAlert_GetFirstLocationDetected(tt *testing.T) { tt.Parallel() s := &SecretScanningAlert{} - s.GetFirstLocation() + s.GetFirstLocationDetected() s = nil - s.GetFirstLocation() + s.GetFirstLocationDetected() } func TestSecretScanningAlert_GetHasMoreLocations(tt *testing.T) { diff --git a/github/secret_scanning.go b/github/secret_scanning.go index 6b5d587431c..f75800f6e0b 100644 --- a/github/secret_scanning.go +++ b/github/secret_scanning.go @@ -21,7 +21,7 @@ type SecretScanningAlert struct { URL *string `json:"url,omitempty"` HTMLURL *string `json:"html_url,omitempty"` LocationsURL *string `json:"locations_url,omitempty"` - FirstLocation *SecretScanningAlertLocationDetails `json:"first_location_detected,omitempty"` + FirstLocationDetected *SecretScanningAlertLocationDetails `json:"first_location_detected,omitempty"` HasMoreLocations *bool `json:"has_more_locations,omitempty"` State *string `json:"state,omitempty"` Resolution *string `json:"resolution,omitempty"`