Repository: google/go-github
Pull request #2834 (2023-07-20 10:25:13)

Add secret type display to secret scanning alert
added support for getting secret type display name when listing secret scanning alerts

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/google/go-github/pull/2834?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
> Merging [#2834](https://app.codecov.io/gh/google/go-github/pull/2834?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (e675dec) into [master](https://app.codecov.io/gh/google/go-github/commit/461d3876720168970777700eb8d27e58a0b85a1e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (461d387) will **not change** coverage.
> The diff coverage is `n/a`.

```diff
@@           Coverage Diff           @@
##           master    #2834   +/-   ##
=======================================
  Coverage   98.06%   98.06%           
=======================================
  Files         137      137           
  Lines       12291    12291           
=======================================
  Hits        12053    12053           
  Misses        162      162           
  Partials       76       76           
```


| [Impacted Files](https://app.codecov.io/gh/google/go-github/pull/2834?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) | Coverage Δ | |
|---|---|---|
| [github/secret\_scanning.go](https://app.codecov.io/gh/google/go-github/pull/2834?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google#diff-Z2l0aHViL3NlY3JldF9zY2FubmluZy5nbw==) | `100.00% <ø> (ø)` | |



Patch:
diff --git a/github/github-accessors.go b/github/github-accessors.go
index cff3c9c1..35e61043 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -19846,6 +19846,14 @@ func (s *SecretScanningAlert) GetSecretType() string {
 	return *s.SecretType
 }
 
+// GetSecretTypeDisplayName returns the SecretTypeDisplayName field if it's non-nil, zero value otherwise.
+func (s *SecretScanningAlert) GetSecretTypeDisplayName() string {
+	if s == nil || s.SecretTypeDisplayName == nil {
+		return ""
+	}
+	return *s.SecretTypeDisplayName
+}
+
 // GetState returns the State field if it's non-nil, zero value otherwise.
 func (s *SecretScanningAlert) GetState() string {
 	if s == nil || s.State == nil {
diff --git a/github/secret_scanning.go b/github/secret_scanning.go
index 36ad5553..b8295cbf 100644
--- a/github/secret_scanning.go
+++ b/github/secret_scanning.go
@@ -16,18 +16,19 @@ 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"`
-	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"`
 }
 
 // SecretScanningAlertLocation represents the location for a secret scanning alert.


Test patch:
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 1ea06998..29d1fd4f 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -23152,6 +23152,16 @@ func TestSecretScanningAlert_GetSecretType(tt *testing.T) {
 	s.GetSecretType()
 }
 
+func TestSecretScanningAlert_GetSecretTypeDisplayName(tt *testing.T) {
+	var zeroValue string
+	s := &SecretScanningAlert{SecretTypeDisplayName: &zeroValue}
+	s.GetSecretTypeDisplayName()
+	s = &SecretScanningAlert{}
+	s.GetSecretTypeDisplayName()
+	s = nil
+	s.GetSecretTypeDisplayName()
+}
+
 func TestSecretScanningAlert_GetState(tt *testing.T) {
 	var zeroValue string
 	s := &SecretScanningAlert{State: &zeroValue}