Skip to content
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