Skip to content

Commit

Permalink
Add Actor field to WorkflowRun (#2381)
Browse files Browse the repository at this point in the history
  • Loading branch information
46158n committed Jun 13, 2022
1 parent 0b5813f commit 6042406
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 1 deletion.
1 change: 1 addition & 0 deletions github/actions_workflow_runs.go
Expand Up @@ -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.
Expand Down
82 changes: 81 additions & 1 deletion github/actions_workflow_runs_test.go
Expand Up @@ -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 := `{
Expand Down Expand Up @@ -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"
}
}`

Expand Down Expand Up @@ -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"),
},
},
},
}
Expand Down Expand Up @@ -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"
}
}
]
}`
Expand Down
8 changes: 8 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6042406

Please sign in to comment.