Repository: google/go-github
Pull request #1869 (2021-05-07 11:53:04)

Add missing fields to Star event
Fixes https://github.com/google/go-github/issues/1868

Hopefully the commit message is okay! Such a small change wasn't really sure what to say.

I believe I followed all the other steps correctly in the `CONTRIBUTING.md` but let me know if something needs fixing.

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

[![Impacted file tree graph](https://codecov.io/gh/google/go-github/pull/1869/graphs/tree.svg?width=650&height=150&src=pr&token=EgYjGjZlI0&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)](https://codecov.io/gh/google/go-github/pull/1869?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)

```diff
@@           Coverage Diff           @@
##           master    #1869   +/-   ##
=======================================
  Coverage   97.65%   97.65%           
=======================================
  Files         105      105           
  Lines        6769     6769           
=======================================
  Hits         6610     6610           
  Misses         86       86           
  Partials       73       73           
```


| [Impacted Files](https://codecov.io/gh/google/go-github/pull/1869?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/1869/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/1869?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/1869?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Last update [b3962ed...fc8e536](https://codecov.io/gh/google/go-github/pull/1869?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 c5fedb25..48347f37 100644
--- a/github/event_types.go
+++ b/github/event_types.go
@@ -916,6 +916,11 @@ type StarEvent struct {
 
 	// StarredAt is the time the star was created. It will be null for the "deleted" action.
 	StarredAt *Timestamp `json:"starred_at,omitempty"`
+
+	// The following fields are only populated by Webhook events.
+	Org    *Organization `json:"organization,omitempty"`
+	Repo   *Repository   `json:"repository,omitempty"`
+	Sender *User         `json:"sender,omitempty"`
 }
 
 // StatusEvent is triggered when the status of a Git commit changes.
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 08108341..b0f06306 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -13884,6 +13884,30 @@ func (s *StarEvent) GetAction() string {
 	return *s.Action
 }
 
+// GetOrg returns the Org field.
+func (s *StarEvent) GetOrg() *Organization {
+	if s == nil {
+		return nil
+	}
+	return s.Org
+}
+
+// GetRepo returns the Repo field.
+func (s *StarEvent) GetRepo() *Repository {
+	if s == nil {
+		return nil
+	}
+	return s.Repo
+}
+
+// GetSender returns the Sender field.
+func (s *StarEvent) GetSender() *User {
+	if s == nil {
+		return nil
+	}
+	return s.Sender
+}
+
 // GetStarredAt returns the StarredAt field if it's non-nil, zero value otherwise.
 func (s *StarEvent) GetStarredAt() Timestamp {
 	if s == nil || s.StarredAt == nil {


Test patch:
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 49ceb123..12c38dd4 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -16273,6 +16273,27 @@ func TestStarEvent_GetAction(tt *testing.T) {
 	s.GetAction()
 }
 
+func TestStarEvent_GetOrg(tt *testing.T) {
+	s := &StarEvent{}
+	s.GetOrg()
+	s = nil
+	s.GetOrg()
+}
+
+func TestStarEvent_GetRepo(tt *testing.T) {
+	s := &StarEvent{}
+	s.GetRepo()
+	s = nil
+	s.GetRepo()
+}
+
+func TestStarEvent_GetSender(tt *testing.T) {
+	s := &StarEvent{}
+	s.GetSender()
+	s = nil
+	s.GetSender()
+}
+
 func TestStarEvent_GetStarredAt(tt *testing.T) {
 	var zeroValue Timestamp
 	s := &StarEvent{StarredAt: &zeroValue}