From 69cd54d34279a194bee34d46cf56b9d277ba6f47 Mon Sep 17 00:00:00 2001 From: vandanrohatgi Date: Fri, 15 Sep 2023 19:39:20 +0530 Subject: [PATCH] Add missing secret scanning alert fields --- github/github-accessors.go | 40 ++++++++++++++++++++++++++++ github/github-accessors_test.go | 47 +++++++++++++++++++++++++++++++++ github/secret_scanning.go | 31 +++++++++++++--------- 3 files changed, 105 insertions(+), 13 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 562ad73456..5f1ecba3b8 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -20382,6 +20382,30 @@ func (s *SecretScanningAlert) GetNumber() int { return *s.Number } +// GetPushProtectionBypassed returns the PushProtectionBypassed field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetPushProtectionBypassed() bool { + if s == nil || s.PushProtectionBypassed == nil { + return false + } + return *s.PushProtectionBypassed +} + +// GetPushProtectionBypassedAt returns the PushProtectionBypassedAt field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetPushProtectionBypassedAt() Timestamp { + if s == nil || s.PushProtectionBypassedAt == nil { + return Timestamp{} + } + return *s.PushProtectionBypassedAt +} + +// GetPushProtectionBypassedBy returns the PushProtectionBypassedBy field. +func (s *SecretScanningAlert) GetPushProtectionBypassedBy() *User { + if s == nil { + return nil + } + return s.PushProtectionBypassedBy +} + // GetRepository returns the Repository field. func (s *SecretScanningAlert) GetRepository() *Repository { if s == nil { @@ -20398,6 +20422,14 @@ func (s *SecretScanningAlert) GetResolution() string { return *s.Resolution } +// GetResolutionComment returns the ResolutionComment field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetResolutionComment() string { + if s == nil || s.ResolutionComment == nil { + return "" + } + return *s.ResolutionComment +} + // GetResolvedAt returns the ResolvedAt field if it's non-nil, zero value otherwise. func (s *SecretScanningAlert) GetResolvedAt() Timestamp { if s == nil || s.ResolvedAt == nil { @@ -20446,6 +20478,14 @@ func (s *SecretScanningAlert) GetState() string { return *s.State } +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (s *SecretScanningAlert) GetUpdatedAt() Timestamp { + if s == nil || s.UpdatedAt == nil { + return Timestamp{} + } + return *s.UpdatedAt +} + // GetURL returns the URL field if it's non-nil, zero value otherwise. func (s *SecretScanningAlert) GetURL() string { if s == nil || s.URL == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 0a6b5271e8..84a517863c 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -23771,6 +23771,33 @@ func TestSecretScanningAlert_GetNumber(tt *testing.T) { s.GetNumber() } +func TestSecretScanningAlert_GetPushProtectionBypassed(tt *testing.T) { + var zeroValue bool + s := &SecretScanningAlert{PushProtectionBypassed: &zeroValue} + s.GetPushProtectionBypassed() + s = &SecretScanningAlert{} + s.GetPushProtectionBypassed() + s = nil + s.GetPushProtectionBypassed() +} + +func TestSecretScanningAlert_GetPushProtectionBypassedAt(tt *testing.T) { + var zeroValue Timestamp + s := &SecretScanningAlert{PushProtectionBypassedAt: &zeroValue} + s.GetPushProtectionBypassedAt() + s = &SecretScanningAlert{} + s.GetPushProtectionBypassedAt() + s = nil + s.GetPushProtectionBypassedAt() +} + +func TestSecretScanningAlert_GetPushProtectionBypassedBy(tt *testing.T) { + s := &SecretScanningAlert{} + s.GetPushProtectionBypassedBy() + s = nil + s.GetPushProtectionBypassedBy() +} + func TestSecretScanningAlert_GetRepository(tt *testing.T) { s := &SecretScanningAlert{} s.GetRepository() @@ -23788,6 +23815,16 @@ func TestSecretScanningAlert_GetResolution(tt *testing.T) { s.GetResolution() } +func TestSecretScanningAlert_GetResolutionComment(tt *testing.T) { + var zeroValue string + s := &SecretScanningAlert{ResolutionComment: &zeroValue} + s.GetResolutionComment() + s = &SecretScanningAlert{} + s.GetResolutionComment() + s = nil + s.GetResolutionComment() +} + func TestSecretScanningAlert_GetResolvedAt(tt *testing.T) { var zeroValue Timestamp s := &SecretScanningAlert{ResolvedAt: &zeroValue} @@ -23845,6 +23882,16 @@ func TestSecretScanningAlert_GetState(tt *testing.T) { s.GetState() } +func TestSecretScanningAlert_GetUpdatedAt(tt *testing.T) { + var zeroValue Timestamp + s := &SecretScanningAlert{UpdatedAt: &zeroValue} + s.GetUpdatedAt() + s = &SecretScanningAlert{} + s.GetUpdatedAt() + s = nil + s.GetUpdatedAt() +} + func TestSecretScanningAlert_GetURL(tt *testing.T) { var zeroValue string s := &SecretScanningAlert{URL: &zeroValue} diff --git a/github/secret_scanning.go b/github/secret_scanning.go index b8295cbf79..bea3f0e701 100644 --- a/github/secret_scanning.go +++ b/github/secret_scanning.go @@ -16,19 +16,24 @@ 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"` + 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"` + 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"` } // SecretScanningAlertLocation represents the location for a secret scanning alert.