Repository: google/go-github
Pull request #2365 (2022-05-15 00:54:45)

Add missing Sender field in RepositoryVulnerabilityAlertEvent
Reference: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#repository_vulnerability_alert

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

```diff
@@           Coverage Diff           @@
##           master    #2365   +/-   ##
=======================================
  Coverage   98.05%   98.05%           
=======================================
  Files         119      119           
  Lines       10503    10503           
=======================================
  Hits        10299    10299           
  Misses        140      140           
  Partials       64       64           
```


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

------

[Continue to review full report at Codecov](https://codecov.io/gh/google/go-github/pull/2365?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/google/go-github/pull/2365?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Last update [8947206...c7e0031](https://codecov.io/gh/google/go-github/pull/2365?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).


Patch:
diff --git a/github/event_types.go b/github/event_types.go
index 7cfba9ab..52fc1408 100644
--- a/github/event_types.go
+++ b/github/event_types.go
@@ -1058,14 +1058,17 @@ type RepositoryVulnerabilityAlertEvent struct {
 	// Action is the action that was performed. Possible values are: "create", "dismiss", "resolve".
 	Action *string `json:"action,omitempty"`
 
-	//The security alert of the vulnerable dependency.
+	// The security alert of the vulnerable dependency.
 	Alert *RepositoryVulnerabilityAlert `json:"alert,omitempty"`
 
-	//The repository of the vulnerable dependency.
+	// The repository of the vulnerable dependency.
 	Repository *Repository `json:"repository,omitempty"`
 
 	// The following fields are only populated by Webhook events.
 	Installation *Installation `json:"installation,omitempty"`
+
+	// The user that triggered the event.
+	Sender *User `json:"sender,omitempty"`
 }
 
 // RepositoryVulnerabilityAlert represents a repository security alert.
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 01444663..873b9753 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -15622,6 +15622,14 @@ func (r *RepositoryVulnerabilityAlertEvent) GetRepository() *Repository {
 	return r.Repository
 }
 
+// GetSender returns the Sender field.
+func (r *RepositoryVulnerabilityAlertEvent) GetSender() *User {
+	if r == nil {
+		return nil
+	}
+	return r.Sender
+}
+
 // GetForkRepos returns the ForkRepos field if it's non-nil, zero value otherwise.
 func (r *RepoStats) GetForkRepos() int {
 	if r == nil || r.ForkRepos == nil {


Test patch:
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 8fdb12e5..71fd7323 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -18223,6 +18223,13 @@ func TestRepositoryVulnerabilityAlertEvent_GetRepository(tt *testing.T) {
 	r.GetRepository()
 }
 
+func TestRepositoryVulnerabilityAlertEvent_GetSender(tt *testing.T) {
+	r := &RepositoryVulnerabilityAlertEvent{}
+	r.GetSender()
+	r = nil
+	r.GetSender()
+}
+
 func TestRepoStats_GetForkRepos(tt *testing.T) {
 	var zeroValue int
 	r := &RepoStats{ForkRepos: &zeroValue}