diff --git a/github/actions_workflow_runs.go b/github/actions_workflow_runs.go index de1e6c277a..18fdd57d6a 100644 --- a/github/actions_workflow_runs.go +++ b/github/actions_workflow_runs.go @@ -44,6 +44,7 @@ type WorkflowRun struct { WorkflowURL *string `json:"workflow_url,omitempty"` Repository *Repository `json:"repository,omitempty"` HeadRepository *Repository `json:"head_repository,omitempty"` + Actor *User `json:"actor,omitempty"` } // WorkflowRuns represents a slice of repository action workflow run. diff --git a/github/actions_workflow_runs_test.go b/github/actions_workflow_runs_test.go index 12f508054f..d22b8a52e8 100644 --- a/github/actions_workflow_runs_test.go +++ b/github/actions_workflow_runs_test.go @@ -638,6 +638,26 @@ func TestWorkflowRun_Marshal(t *testing.T) { URL: String("u"), Name: String("n"), }, + Actor: &User{ + Login: String("l"), + ID: Int64(1), + AvatarURL: String("a"), + GravatarID: String("g"), + Name: String("n"), + Company: String("c"), + Blog: String("b"), + Location: String("l"), + Email: String("e"), + Hireable: Bool(true), + Bio: String("b"), + TwitterUsername: String("t"), + PublicRepos: Int(1), + Followers: Int(1), + Following: Int(1), + CreatedAt: &Timestamp{referenceTime}, + SuspendedAt: &Timestamp{referenceTime}, + URL: String("u"), + }, } want := `{ @@ -718,6 +738,26 @@ func TestWorkflowRun_Marshal(t *testing.T) { "id": 1, "url": "u", "name": "n" + }, + "actor": { + "login": "l", + "id": 1, + "avatar_url": "a", + "gravatar_id": "g", + "name": "n", + "company": "c", + "blog": "b", + "location": "l", + "email": "e", + "hireable": true, + "bio": "b", + "twitter_username": "t", + "public_repos": 1, + "followers": 1, + "following": 1, + "created_at": ` + referenceTimeStr + `, + "suspended_at": ` + referenceTimeStr + `, + "url": "u" } }` @@ -809,6 +849,26 @@ func TestWorkflowRuns_Marshal(t *testing.T) { URL: String("u"), Name: String("n"), }, + Actor: &User{ + Login: String("l"), + ID: Int64(1), + AvatarURL: String("a"), + GravatarID: String("g"), + Name: String("n"), + Company: String("c"), + Blog: String("b"), + Location: String("l"), + Email: String("e"), + Hireable: Bool(true), + Bio: String("b"), + TwitterUsername: String("t"), + PublicRepos: Int(1), + Followers: Int(1), + Following: Int(1), + CreatedAt: &Timestamp{referenceTime}, + SuspendedAt: &Timestamp{referenceTime}, + URL: String("u"), + }, }, }, } @@ -894,7 +954,27 @@ func TestWorkflowRuns_Marshal(t *testing.T) { "id": 1, "url": "u", "name": "n" - } + }, + "actor": { + "login": "l", + "id": 1, + "avatar_url": "a", + "gravatar_id": "g", + "name": "n", + "company": "c", + "blog": "b", + "location": "l", + "email": "e", + "hireable": true, + "bio": "b", + "twitter_username": "t", + "public_repos": 1, + "followers": 1, + "following": 1, + "created_at": ` + referenceTimeStr + `, + "suspended_at": ` + referenceTimeStr + `, + "url": "u" + } } ] }` diff --git a/github/github-accessors.go b/github/github-accessors.go index 774dc0bf0c..c1cb0d1f4d 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -19654,6 +19654,14 @@ func (w *WorkflowJobEvent) GetWorkflowJob() *WorkflowJob { return w.WorkflowJob } +// GetActor returns the Actor field. +func (w *WorkflowRun) GetActor() *User { + if w == nil { + return nil + } + return w.Actor +} + // GetArtifactsURL returns the ArtifactsURL field if it's non-nil, zero value otherwise. func (w *WorkflowRun) GetArtifactsURL() string { if w == nil || w.ArtifactsURL == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index f07c21b865..8013462017 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -22978,6 +22978,13 @@ func TestWorkflowJobEvent_GetWorkflowJob(tt *testing.T) { w.GetWorkflowJob() } +func TestWorkflowRun_GetActor(tt *testing.T) { + w := &WorkflowRun{} + w.GetActor() + w = nil + w.GetActor() +} + func TestWorkflowRun_GetArtifactsURL(tt *testing.T) { var zeroValue string w := &WorkflowRun{ArtifactsURL: &zeroValue}