+
Skip to content

Add struct for workflow_job event #2038

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from Sep 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions github/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ func (e *Event) ParsePayload() (payload interface{}, err error) {
payload = &WatchEvent{}
case "WorkflowDispatchEvent":
payload = &WorkflowDispatchEvent{}
case "WorkflowJobEvent":
payload = &WorkflowJobEvent{}
case "WorkflowRunEvent":
payload = &WorkflowRunEvent{}
}
Expand Down
14 changes: 14 additions & 0 deletions github/event_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,20 @@ type WorkflowDispatchEvent struct {
Sender *User `json:"sender,omitempty"`
}

// WorkflowJobEvent is triggered when a job is queued, started or completed.
//
// GitHub API docs: pending
type WorkflowJobEvent struct {
WorkflowJob *WorkflowJob `json:"workflow_job,omitempty"`

Action *string `json:"action,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"`
}

// WorkflowRunEvent is triggered when a GitHub Actions workflow run is requested or completed.
//
// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#workflow_run
Expand Down
40 changes: 40 additions & 0 deletions github/github-accessors.go

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

38 changes: 38 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.

1 change: 1 addition & 0 deletions github/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ var (
"user": "UserEvent",
"watch": "WatchEvent",
"workflow_dispatch": "WorkflowDispatchEvent",
"workflow_job": "WorkflowJobEvent",
"workflow_run": "WorkflowRunEvent",
}
)
Expand Down
4 changes: 4 additions & 0 deletions github/messages_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,10 @@ func TestParseWebHook(t *testing.T) {
payload: &WorkflowDispatchEvent{},
messageType: "workflow_dispatch",
},
{
payload: &WorkflowJobEvent{},
messageType: "workflow_job",
},
{
payload: &WorkflowRunEvent{},
messageType: "workflow_run",
Expand Down
1 change: 1 addition & 0 deletions github/repos_hooks_deliveries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ var hookDeliveryPayloadTypeToStruct = map[string]interface{}{
"user": &UserEvent{},
"watch": &WatchEvent{},
"workflow_dispatch": &WorkflowDispatchEvent{},
"workflow_job": &WorkflowJobEvent{},
"workflow_run": &WorkflowRunEvent{},
}

Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载