-
Notifications
You must be signed in to change notification settings - Fork 17
/
event_types.go
124 lines (102 loc) · 5.73 KB
/
event_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package schemas
import (
"time"
"cloud.google.com/go/bigquery"
)
type Wrapper[T any] struct {
When time.Time
Body T
}
// https://pkg.go.dev/github.com/google/go-github/v60/github#User
type User struct {
Login bigquery.NullString `json:"login,omitempty" bigquery:"login"`
Type bigquery.NullString `json:"type,omitempty" bigquery:"type"`
}
// https://pkg.go.dev/github.com/google/go-github/v60/github#Organization
type Organization struct {
Login bigquery.NullString `json:"login,omitempty" bigquery:"login"`
}
// https://pkg.go.dev/github.com/google/go-github/v60/github#Repository
type Repository struct {
Owner User
Name bigquery.NullString `json:"name,omitempty" bigquery:"name"`
URL bigquery.NullString `json:"url,omitempty" bigquery:"url"`
FullName bigquery.NullString `json:"full_name,omitempty" bigquery:"full_name"`
}
// https://pkg.go.dev/github.com/google/go-github/v60/github#PullRequestBranch
type PullRequestBranch struct {
Ref bigquery.NullString `json:"ref,omitempty" bigquery:"ref"`
SHA bigquery.NullString `json:"sha,omitempty" bigquery:"sha"`
Repo Repository `json:"repo,omitempty" bigquery:"repo"`
User User `json:"user,omitempty" bigquery:"user"`
}
type Label struct {
Name bigquery.NullString `json:"name,omitempty" bigquery:"name"`
}
// https://pkg.go.dev/github.com/google/go-github/v60/github#PullRequest
type PullRequest struct {
Number bigquery.NullInt64 `json:"number,omitempty" bigquery:"number"`
State bigquery.NullString `json:"state,omitempty" bigquery:"state"`
Title bigquery.NullString `json:"title,omitempty" bigquery:"title"`
Base PullRequestBranch `json:"base,omitempty" bigquery:"base"`
Head PullRequestBranch `json:"head,omitempty" bigquery:"head"`
Labels []Label `json:"labels" bigquery:"labels"`
CreatedAt bigquery.NullTimestamp `json:"created_at,omitempty" bigquery:"created_at"`
UpdatedAt bigquery.NullTimestamp `json:"updated_at,omitempty" bigquery:"updated_at"`
ClosedAt bigquery.NullTimestamp `json:"closed_at,omitempty" bigquery:"closed_at"`
MergedAt bigquery.NullTimestamp `json:"merged_at,omitempty" bigquery:"merged_at"`
Mergeable bigquery.NullBool `json:"mergeable,omitempty" bigquery:"mergeable"`
MergeableState bigquery.NullString `json:"mergeable_state,omitempty" bigquery:"mergeable_state"`
MergedBy User `json:"merged_by,omitempty" bigquery:"merged_by"`
MergeCommitSHA bigquery.NullString `json:"merge_commit_sha,omitempty" bigquery:"merge_commit_sha"`
Additions bigquery.NullInt64 `json:"additions,omitempty" bigquery:"additions"`
Deletions bigquery.NullInt64 `json:"deletions,omitempty" bigquery:"deletions"`
ChangedFiles bigquery.NullInt64 `json:"changed_files,omitempty" bigquery:"changed_files"`
}
// https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
// https://pkg.go.dev/github.com/google/go-github/v60/github#PullRequestEvent
type PullRequestEvent struct {
// assigned,opened etc.
Action bigquery.NullString `json:"action,omitempty" bigquery:"action"`
Sender User `json:"sender,omitempty" bigquery:"sender"`
Assignee User `json:"assignee,omitempty" bigquery:"assignee"`
Repository Repository `json:"repository,omitempty" bigquery:"repository"`
PullRequest PullRequest `json:"pull_request,omitempty" bigquery:"pull_request"`
// Populated when action is synchronize
Before bigquery.NullString `json:"before,omitempty" bigquery:"before"`
After bigquery.NullString `json:"after,omitempty" bigquery:"after"`
}
// https://pkg.go.dev/github.com/google/go-github/v60/github#Workflow
type Workflow struct {
ID bigquery.NullInt64 `json:"id,omitempty" bigquery:"id"`
Name bigquery.NullString `json:"name,omitempty" bigquery:"name"`
Path bigquery.NullString `json:"path,omitempty" bigquery:"path"`
State bigquery.NullString `json:"state,omitempty" bigquery:"state"`
CreatedAt bigquery.NullTimestamp `json:"created_at,omitempty" bigquery:"created_at"`
UpdatedAt bigquery.NullTimestamp `json:"updated_at,omitempty" bigquery:"updated_at"`
}
// https://pkg.go.dev/github.com/google/go-github/v60/github#WorkflowRun
type WorkflowRun struct {
ID bigquery.NullInt64 `json:"id,omitempty" bigquery:"id"`
RunNumber bigquery.NullInt64 `json:"run_number,omitempty" bigquery:"run_number"`
RunAttempt bigquery.NullInt64 `json:"run_attempt,omitempty" bigquery:"run_attempt"`
HeadBranch bigquery.NullString `json:"head_branch,omitempty" bigquery:"head_branch"`
HeadSHA bigquery.NullString `json:"head_sha,omitempty" bigquery:"head_sha"`
Name bigquery.NullString `json:"name,omitempty" bigquery:"name"`
Event bigquery.NullString `json:"event,omitempty" bigquery:"event"`
Status bigquery.NullString `json:"status,omitempty" bigquery:"status"`
RunStartedAt bigquery.NullTimestamp `json:"run_started_at,omitempty" bigquery:"run_started_at"`
// success, failure, cancelled, etc.
Conclusion bigquery.NullString `json:"conclusion,omitempty" bigquery:"conclusion"`
}
// https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#workflow_run
// subset of https://pkg.go.dev/github.com/google/go-github/v60/github#WorkflowRunEvent
type WorkflowRunEvent struct {
// completed, etc.
Action bigquery.NullString `json:"action,omitempty" bigquery:"action"`
Workflow Workflow `json:"workflow,omitempty" bigquery:"workflow"`
WorkflowRun WorkflowRun `json:"workflow_run,omitempty" bigquery:"workflow_run"`
Organization Organization `json:"organization,omitempty" bigquery:"organization"`
Repository Repository `json:"repository,omitempty" bigquery:"repository"`
Sender User `json:"sender,omitempty" bigquery:"sender"`
}