Skip to content

Commit 067e3f1

Browse files
committed
Add SecurityAdvisoryPayload struct
1 parent 0f4713c commit 067e3f1

File tree

1 file changed

+71
-39
lines changed

1 file changed

+71
-39
lines changed

github/payload.go

Lines changed: 71 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@ import "time"
44

55
// CheckRunPayload contains the information for GitHub's check_run hook event
66
type CheckRunPayload struct {
7-
Action string `json:"action"`
7+
Action string `json:"action"`
88
CheckRun struct {
9-
ID int64 `json:"id"`
10-
Name string `json:"name"`
11-
HeadSHA string `json:"head_sha"`
12-
Status string `json:"status"`
13-
Conclusion string `json:"conclusion"`
14-
URL string `json:"url"`
15-
HtmlURL string `json:"html_url"`
16-
StarterAt time.Time `json:"started_at"`
17-
CompletedAt time.Time `json:"completed_at"`
18-
Output struct {
9+
ID int64 `json:"id"`
10+
Name string `json:"name"`
11+
HeadSHA string `json:"head_sha"`
12+
Status string `json:"status"`
13+
Conclusion string `json:"conclusion"`
14+
URL string `json:"url"`
15+
HtmlURL string `json:"html_url"`
16+
StarterAt time.Time `json:"started_at"`
17+
CompletedAt time.Time `json:"completed_at"`
18+
Output struct {
1919
Title string `json:"title"`
2020
Summary string `json:"summary"`
2121
Text string `json:"text"`
@@ -32,8 +32,8 @@ type CheckRunPayload struct {
3232
Before string `json:"before"`
3333
After string `json:"after"`
3434
PullRequests []PullRequestPayload `json:"pull_requests"`
35-
App struct {
36-
ID int64 `json:"id"`
35+
App struct {
36+
ID int64 `json:"id"`
3737
Owner struct {
3838
Login string `json:"login"`
3939
ID int64 `json:"id"`
@@ -53,18 +53,18 @@ type CheckRunPayload struct {
5353
Type string `json:"type"`
5454
SiteAdmin bool `json:"site_admin"`
5555
} `json:"owner"`
56-
Name string `json:"name"`
57-
Description string `json:"description"`
58-
ExternalURL string `json:"external_url"`
59-
HtmlURL string `json:"html_url"`
60-
CreatedAt string `json:"created_at"`
61-
UpdatedAt string `json:"updated_at"`
56+
Name string `json:"name"`
57+
Description string `json:"description"`
58+
ExternalURL string `json:"external_url"`
59+
HtmlURL string `json:"html_url"`
60+
CreatedAt string `json:"created_at"`
61+
UpdatedAt string `json:"updated_at"`
6262
} `json:"app"`
63-
CreatedAt time.Time `json:"created_at"`
64-
UpdatedAt time.Time `json:"updated_at"`
63+
CreatedAt time.Time `json:"created_at"`
64+
UpdatedAt time.Time `json:"updated_at"`
6565
} `json:"check_suite"`
6666
App struct {
67-
ID int64 `json:"id"`
67+
ID int64 `json:"id"`
6868
Owner struct {
6969
Login string `json:"login"`
7070
ID int64 `json:"id"`
@@ -84,12 +84,12 @@ type CheckRunPayload struct {
8484
Type string `json:"type"`
8585
SiteAdmin bool `json:"site_admin"`
8686
} `json:"owner"`
87-
Name string `json:"name"`
88-
Description string `json:"description"`
89-
ExternalURL string `json:"external_url"`
90-
HtmlURL string `json:"html_url"`
91-
CreatedAt string `json:"created_at"`
92-
UpdatedAt string `json:"updated_at"`
87+
Name string `json:"name"`
88+
Description string `json:"description"`
89+
ExternalURL string `json:"external_url"`
90+
HtmlURL string `json:"html_url"`
91+
CreatedAt string `json:"created_at"`
92+
UpdatedAt string `json:"updated_at"`
9393
} `json:"app"`
9494
PullRequests []PullRequestPayload `json:"pull_requests"`
9595
} `json:"check_run"`
@@ -203,7 +203,7 @@ type CheckRunPayload struct {
203203

204204
// CheckSuitePayload contains the information for GitHub's check_suite hook event
205205
type CheckSuitePayload struct {
206-
Action string `json:"action"`
206+
Action string `json:"action"`
207207
CheckSuite struct {
208208
ID int64 `json:"id"`
209209
HeadBranch string `json:"head_branch"`
@@ -214,8 +214,8 @@ type CheckSuitePayload struct {
214214
Before string `json:"before"`
215215
After string `json:"after"`
216216
PullRequests []PullRequestPayload `json:"pull_requests"`
217-
App struct {
218-
ID int64 `json:"id"`
217+
App struct {
218+
ID int64 `json:"id"`
219219
Owner struct {
220220
Login string `json:"login"`
221221
ID int64 `json:"id"`
@@ -235,23 +235,23 @@ type CheckSuitePayload struct {
235235
Type string `json:"type"`
236236
SiteAdmin bool `json:"site_admin"`
237237
} `json:"owner"`
238-
Name string `json:"name"`
239-
Description string `json:"description"`
240-
ExternalURL string `json:"external_url"`
241-
HtmlURL string `json:"html_url"`
242-
CreatedAt string `json:"created_at"`
243-
UpdatedAt string `json:"updated_at"`
238+
Name string `json:"name"`
239+
Description string `json:"description"`
240+
ExternalURL string `json:"external_url"`
241+
HtmlURL string `json:"html_url"`
242+
CreatedAt string `json:"created_at"`
243+
UpdatedAt string `json:"updated_at"`
244244
} `json:"app"`
245245
CreatedAt time.Time `json:"created_at"`
246246
UpdatedAt time.Time `json:"updated_at"`
247247
LatestCheckRunsCount int64 `json:"latest_check_runs_count"`
248248
CheckRunsURL string `json:"check_runs_url"`
249-
HeadCommit struct {
249+
HeadCommit struct {
250250
ID string `json:"id"`
251251
TreeID string `json:"tree_id"`
252252
Message string `json:"message"`
253253
Timestamp time.Time `json:"timestamp"`
254-
Author struct {
254+
Author struct {
255255
Name string `json:"name"`
256256
Email string `json:"email"`
257257
} `json:"author"`
@@ -5077,6 +5077,38 @@ type RepositoryPayload struct {
50775077
} `json:"sender"`
50785078
}
50795079

5080+
// SecurityAdvisoryPayload contains the information for GitHub's security_advisory hook event.
5081+
type SecurityAdvisoryPayload struct {
5082+
Action string `json:"action"`
5083+
SecurityAdvisory struct {
5084+
GHSAID string `json:"ghsa_id"`
5085+
Summary string `json:"summary"`
5086+
Description string `json:"description"`
5087+
Severity string `json:"string"`
5088+
Identifiers []struct {
5089+
Value string `json:"value"`
5090+
Type string `json:"type"`
5091+
} `json:"identifiers"`
5092+
References []struct {
5093+
URL string `json:"url"`
5094+
} `json:"references"`
5095+
PublishedAt time.Time `json:"published_at"`
5096+
UpdatedAt time.Time `json:"updated_at"`
5097+
WithdrawnAt *time.Time `json:"withdrawn_at"`
5098+
Vulnerabilities []struct {
5099+
Package struct {
5100+
Ecosystem string `json:"ecosystem"`
5101+
Name string `json:"name"`
5102+
}
5103+
Severity string `json:"severity"`
5104+
VulnerableVersionRange string `json:"vulnerable_version_range"`
5105+
FirstPatchedVersion *struct {
5106+
Identifier string `json:"identifier"`
5107+
} `json:"first_patched_version"`
5108+
} `json:"vulnerabilities"`
5109+
} `json:"security_advisory"`
5110+
}
5111+
50805112
// StatusPayload contains the information for GitHub's status hook event
50815113
type StatusPayload struct {
50825114
ID int64 `json:"id"`

0 commit comments

Comments
 (0)