Repository: google/go-github
Pull request #2763 (2023-04-18 10:49:00)

Add requester to InstallationEvent
This pull request adds the `Requester` property to the `InstallationEvent` struct.

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

```diff
@@           Coverage Diff           @@
##           master    #2763   +/-   ##
=======================================
  Coverage   98.05%   98.05%           
=======================================
  Files         132      132           
  Lines       11638    11638           
=======================================
  Hits        11412    11412           
  Misses        154      154           
  Partials       72       72           
```


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

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)


Patch:
diff --git a/github/actions_workflow_jobs.go b/github/actions_workflow_jobs.go
index b7130916..1f018b3e 100644
--- a/github/actions_workflow_jobs.go
+++ b/github/actions_workflow_jobs.go
@@ -28,6 +28,7 @@ type WorkflowJob struct {
 	RunID       *int64      `json:"run_id,omitempty"`
 	RunURL      *string     `json:"run_url,omitempty"`
 	NodeID      *string     `json:"node_id,omitempty"`
+	HeadBranch  *string     `json:"head_branch,omitempty"`
 	HeadSHA     *string     `json:"head_sha,omitempty"`
 	URL         *string     `json:"url,omitempty"`
 	HTMLURL     *string     `json:"html_url,omitempty"`
diff --git a/github/event_types.go b/github/event_types.go
index 2340a601..685e46f0 100644
--- a/github/event_types.go
+++ b/github/event_types.go
@@ -469,7 +469,7 @@ type InstallationEvent struct {
 	Repositories []*Repository `json:"repositories,omitempty"`
 	Sender       *User         `json:"sender,omitempty"`
 	Installation *Installation `json:"installation,omitempty"`
-	// TODO key "requester" is not covered
+	Requester    *User         `json:"requester,omitempty"`
 }
 
 // InstallationRepositoriesEvent is triggered when a repository is added or
diff --git a/github/github-accessors.go b/github/github-accessors.go
index eea7518c..76357945 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -7358,6 +7358,14 @@ func (i *InstallationEvent) GetInstallation() *Installation {
 	return i.Installation
 }
 
+// GetRequester returns the Requester field.
+func (i *InstallationEvent) GetRequester() *User {
+	if i == nil {
+		return nil
+	}
+	return i.Requester
+}
+
 // GetSender returns the Sender field.
 func (i *InstallationEvent) GetSender() *User {
 	if i == nil {
@@ -21798,6 +21806,14 @@ func (w *WorkflowJob) GetCreatedAt() Timestamp {
 	return *w.CreatedAt
 }
 
+// GetHeadBranch returns the HeadBranch field if it's non-nil, zero value otherwise.
+func (w *WorkflowJob) GetHeadBranch() string {
+	if w == nil || w.HeadBranch == nil {
+		return ""
+	}
+	return *w.HeadBranch
+}
+
 // GetHeadSHA returns the HeadSHA field if it's non-nil, zero value otherwise.
 func (w *WorkflowJob) GetHeadSHA() string {
 	if w == nil || w.HeadSHA == nil {


Test patch:
diff --git a/github/actions_workflow_jobs_test.go b/github/actions_workflow_jobs_test.go
index 521e4011..8cea9545 100644
--- a/github/actions_workflow_jobs_test.go
+++ b/github/actions_workflow_jobs_test.go
@@ -246,6 +246,7 @@ func TestWorkflowJob_Marshal(t *testing.T) {
 		RunID:       Int64(1),
 		RunURL:      String("r"),
 		NodeID:      String("n"),
+		HeadBranch:  String("b"),
 		HeadSHA:     String("h"),
 		URL:         String("u"),
 		HTMLURL:     String("h"),
@@ -274,6 +275,7 @@ func TestWorkflowJob_Marshal(t *testing.T) {
 		"run_id": 1,
 		"run_url": "r",
 		"node_id": "n",
+		"head_branch": "b",
 		"head_sha": "h",
 		"url": "u",
 		"html_url": "h",
@@ -309,6 +311,7 @@ func TestJobs_Marshal(t *testing.T) {
 				RunID:       Int64(1),
 				RunURL:      String("r"),
 				NodeID:      String("n"),
+				HeadBranch:  String("b"),
 				HeadSHA:     String("h"),
 				URL:         String("u"),
 				HTMLURL:     String("h"),
@@ -342,6 +345,7 @@ func TestJobs_Marshal(t *testing.T) {
 			"run_id": 1,
 			"run_url": "r",
 			"node_id": "n",
+			"head_branch": "b",
 			"head_sha": "h",
 			"url": "u",
 			"html_url": "h",
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 5b2054bf..ad885a4c 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -8634,6 +8634,13 @@ func TestInstallationEvent_GetInstallation(tt *testing.T) {
 	i.GetInstallation()
 }
 
+func TestInstallationEvent_GetRequester(tt *testing.T) {
+	i := &InstallationEvent{}
+	i.GetRequester()
+	i = nil
+	i.GetRequester()
+}
+
 func TestInstallationEvent_GetSender(tt *testing.T) {
 	i := &InstallationEvent{}
 	i.GetSender()
@@ -25481,6 +25488,16 @@ func TestWorkflowJob_GetCreatedAt(tt *testing.T) {
 	w.GetCreatedAt()
 }
 
+func TestWorkflowJob_GetHeadBranch(tt *testing.T) {
+	var zeroValue string
+	w := &WorkflowJob{HeadBranch: &zeroValue}
+	w.GetHeadBranch()
+	w = &WorkflowJob{}
+	w.GetHeadBranch()
+	w = nil
+	w.GetHeadBranch()
+}
+
 func TestWorkflowJob_GetHeadSHA(tt *testing.T) {
 	var zeroValue string
 	w := &WorkflowJob{HeadSHA: &zeroValue}