Repository: google/go-github
Pull request #3353 (2024-11-19 22:34:44)

Add missing Deployment field to workflow_job event type
The `workflow_job` webhook event as described by GitHub documentation contains a `deployment` object. 
https://docs.github.com/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#workflow_job

However, the struct that defines the `workflow_job `webhook event type is missing the `deployment` object . This PR adds the missing object to the `WorkflowJobEvent` type.

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/google/go-github/pull/3353?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 92.30%. Comparing base [(`2b8c7fa`)](https://app.codecov.io/gh/google/go-github/commit/2b8c7fa86fcd1cb4a89a44c8e7b5a49fe4be8a45?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) to head [(`dc752c2`)](https://app.codecov.io/gh/google/go-github/commit/dc752c2152a10f1c01c7c9a133c6e220ac3d7301?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).
> Report is 173 commits behind head on master.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master    #3353      +/-   ##
==========================================
- Coverage   97.72%   92.30%   -5.42%     
==========================================
  Files         153      176      +23     
  Lines       13390    15031    +1641     
==========================================
+ Hits        13085    13874     +789     
- Misses        215     1064     +849     
- Partials       90       93       +3     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/google/go-github/pull/3353?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).

----
🚨 Try these New Features:

- [Flaky Tests Detection](https://docs.codecov.com/docs/test-result-ingestion-beta) - Detect and resolve failed and flaky tests

Patch:
diff --git a/github/event_types.go b/github/event_types.go
index 40ad919b..373d59ba 100644
--- a/github/event_types.go
+++ b/github/event_types.go
@@ -1787,6 +1787,7 @@ type WorkflowJobEvent struct {
 	Repo         *Repository   `json:"repository,omitempty"`
 	Sender       *User         `json:"sender,omitempty"`
 	Installation *Installation `json:"installation,omitempty"`
+	Deployment   *Deployment   `json:"deployment,omitempty"`
 }
 
 // WorkflowRunEvent is triggered when a GitHub Actions workflow run is requested or completed.
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 7d8292a9..ed9353d1 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -26574,6 +26574,14 @@ func (w *WorkflowJobEvent) GetAction() string {
 	return *w.Action
 }
 
+// GetDeployment returns the Deployment field.
+func (w *WorkflowJobEvent) GetDeployment() *Deployment {
+	if w == nil {
+		return nil
+	}
+	return w.Deployment
+}
+
 // GetInstallation returns the Installation field.
 func (w *WorkflowJobEvent) GetInstallation() *Installation {
 	if w == nil {


Test patch:
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 4d7b022e..4269618a 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -34093,6 +34093,14 @@ func TestWorkflowJobEvent_GetAction(tt *testing.T) {
 	w.GetAction()
 }
 
+func TestWorkflowJobEvent_GetDeployment(tt *testing.T) {
+	tt.Parallel()
+	w := &WorkflowJobEvent{}
+	w.GetDeployment()
+	w = nil
+	w.GetDeployment()
+}
+
 func TestWorkflowJobEvent_GetInstallation(tt *testing.T) {
 	tt.Parallel()
 	w := &WorkflowJobEvent{}