Skip to content

Commit

Permalink
removed some uncesserary changes to testdata
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikrudstrom committed Oct 9, 2019
1 parent 1950225 commit 62af9fc
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 131 deletions.
43 changes: 22 additions & 21 deletions github/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,32 @@ type CheckPullRequest struct {
type CheckRunPayload struct {
Action string `json:"action"`
CheckRun struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Name string `json:"name"`
HeadSHA string `json:"head_sha"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
URL string `json:"url"`
HtmlURL string `json:"html_url"`
StarterAt time.Time `json:"started_at"`
CompletedAt time.Time `json:"completed_at"`
DetailsURL string `json:"details_url"`
ExternalID string `json:"external_id"`
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Name string `json:"name"`
HeadSHA string `json:"head_sha"`
Status string `json:"status"`
Conclusion *string `json:"conclusion"`
URL string `json:"url"`
HtmlURL string `json:"html_url"`
StarterAt time.Time `json:"started_at"`
CompletedAt *time.Time `json:"completed_at"`
DetailsURL string `json:"details_url"`
ExternalID string `json:"external_id"`
Output struct {
Title string `json:"title"`
Summary string `json:"summary"`
Text string `json:"text"`
AnnotationsCount int64 `json:"annotations_count"`
AnnotationsURL string `json:"annotations_url"`
Title *string `json:"title"`
Summary *string `json:"summary"`
Text *string `json:"text"`
AnnotationsCount int64 `json:"annotations_count"`
AnnotationsURL string `json:"annotations_url"`
} `json:"output"`
CheckSuite struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
HeadBranch string `json:"head_branch"`
HeadSHA string `json:"head_sha"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
Conclusion *string `json:"conclusion"`
URL string `json:"url"`
Before string `json:"before"`
After string `json:"after"`
Expand All @@ -82,7 +82,7 @@ type CheckSuitePayload struct {
HeadBranch string `json:"head_branch"`
HeadSHA string `json:"head_sha"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
Conclusion *string `json:"conclusion"`
URL string `json:"url"`
Before string `json:"before"`
After string `json:"after"`
Expand Down Expand Up @@ -654,7 +654,7 @@ type PullRequestReviewPayload struct {
CommitID string `json:"commit_id"`
AuthorAssociation string `json:"author_association"`
User User `json:"user"`
Body string `json:"body"`
Body *string `json:"body"`
SubmittedAt time.Time `json:"submitted_at"`
State string `json:"state"`
HTMLURL string `json:"html_url"`
Expand Down Expand Up @@ -705,7 +705,8 @@ type PullRequestReviewCommentPayload struct {
Href string `json:"href"`
} `json:"pull_request"`
} `json:"_links"`
InReplyToID int64 `json:"in_reply_to_id"` //TODO this is not in the unmodified payload example on github docs
//TODO this is not in the payload example on github docs
// InReplyToID int64 `json:"in_reply_to_id"`
PullRequestReviewID int64 `json:"pull_request_review_id"`
} `json:"comment"`
PullRequest ReviewPullRequest `json:"pull_request"`
Expand Down
2 changes: 1 addition & 1 deletion scrape/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func main() {
collected := collect()
fmt.Printf("Found %s examle payloads. \n", len(collected))
root, _ := os.Getwd()
folder := path.Join(root, "tmp")
folder := path.Join(root, "testdata/github")
if _, err := os.Stat(folder); os.IsNotExist(err) {
os.Mkdir(folder, 0777)
}
Expand Down
26 changes: 15 additions & 11 deletions testdata/github/check-run.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
"id": 128620228,
"node_id": "MDg6Q2hlY2tSdW4xMjg2MjAyMjg=",
"head_sha": "ec26c3e57ca3a959ca5aad62de7213c562f8c821",
"external_id": "123",
"external_id": "",
"url": "https://api.github.com/repos/Codertocat/Hello-World/check-runs/128620228",
"html_url": "https://github.com/Codertocat/Hello-World/runs/128620228",
"details_url": "https://octocoders.io",
"status": "queued",
"conclusion": "success",
"conclusion": null,
"started_at": "2019-05-15T15:21:12Z",
"completed_at": "2019-05-15T15:21:12Z",
"completed_at": null,
"output": {
"title": "title",
"summary": "summary",
"text": "some text",
"title": null,
"summary": null,
"text": null,
"annotations_count": 0,
"annotations_url": "https://api.github.com/repos/Codertocat/Hello-World/check-runs/128620228/annotations"
},
Expand All @@ -26,7 +26,7 @@
"head_branch": "changes",
"head_sha": "ec26c3e57ca3a959ca5aad62de7213c562f8c821",
"status": "queued",
"conclusion": "success",
"conclusion": null,
"url": "https://api.github.com/repos/Codertocat/Hello-World/check-suites/118578147",
"before": "6113728f27ae82c7b1a177c8d03f9e96e0adf246",
"after": "ec26c3e57ca3a959ca5aad62de7213c562f8c821",
Expand Down Expand Up @@ -105,7 +105,9 @@
"team_discussions": "write",
"vulnerability_alerts": "read"
},
"events": []
"events": [

]
},
"created_at": "2019-05-15T15:20:31Z",
"updated_at": "2019-05-15T15:20:31Z"
Expand Down Expand Up @@ -160,7 +162,9 @@
"team_discussions": "write",
"vulnerability_alerts": "read"
},
"events": []
"events": [

]
},
"pull_requests": [
{
Expand Down Expand Up @@ -215,7 +219,7 @@
"site_admin": false
},
"html_url": "https://github.com/Codertocat/Hello-World",
"description": "test",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/Codertocat/Hello-World",
"forks_url": "https://api.github.com/repos/Codertocat/Hello-World/forks",
Expand Down Expand Up @@ -276,7 +280,7 @@
"archived": false,
"disabled": false,
"open_issues_count": 2,
"license": "licence",
"license": null,
"forks": 1,
"open_issues": 2,
"watchers": 0,
Expand Down
6 changes: 4 additions & 2 deletions testdata/github/check-suite.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@
"team_discussions": "write",
"vulnerability_alerts": "read"
},
"events": []
"events": [

]
},
"created_at": "2019-05-15T15:20:31Z",
"updated_at": "2019-05-15T15:21:14Z",
Expand Down Expand Up @@ -133,7 +135,7 @@
"site_admin": false
},
"html_url": "https://github.com/Codertocat/Hello-World",
"description": "desc",
"description": null,
"fork": false,
"url": "https://api.github.com/repos/Codertocat/Hello-World",
"forks_url": "https://api.github.com/repos/Codertocat/Hello-World/forks",
Expand Down
2 changes: 1 addition & 1 deletion testdata/github/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"type": "User",
"site_admin": false
},
"disabled": false,
"private": false,
"html_url": "https://github.com/Codertocat/Hello-World",
"description": null,
Expand Down Expand Up @@ -102,6 +101,7 @@
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 1,
"license": null,
"forks": 0,
Expand Down
17 changes: 12 additions & 5 deletions testdata/github/pull-request-review-comment.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"comment": {
"url": "https://api.github.com/repos/Codertocat/Hello-World/pulls/comments/284312630",
"pull_request_review_id": 237895671,
"in_reply_to_id": 456545654,
"id": 284312630,
"node_id": "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI4NDMxMjYzMA==",
"diff_hunk": "@@ -1 +1 @@\n-# Hello-World",
Expand Down Expand Up @@ -89,10 +88,18 @@
"merged_at": null,
"merge_commit_sha": "c4295bd74fb0f4fda03689c3df3f2803b658fd85",
"assignee": null,
"assignees": [],
"requested_reviewers": [],
"requested_teams": [],
"labels": [],
"assignees": [

],
"requested_reviewers": [

],
"requested_teams": [

],
"labels": [

],
"milestone": null,
"commits_url": "https://api.github.com/repos/Codertocat/Hello-World/pulls/2/commits",
"review_comments_url": "https://api.github.com/repos/Codertocat/Hello-World/pulls/2/comments",
Expand Down
18 changes: 2 additions & 16 deletions testdata/github/pull-request-review.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"type": "User",
"site_admin": false
},
"body": "this is awesome",
"body": null,
"commit_id": "ec26c3e57ca3a959ca5aad62de7213c562f8c821",
"submitted_at": "2019-05-15T15:20:38Z",
"state": "commented",
Expand Down Expand Up @@ -80,21 +80,7 @@
"assignee": null,
"assignees": [],
"requested_reviewers": [],
"requested_teams": [
{
"name": "go-team",
"id": 123456,
"node_id": "MDEwOlJlcG9zaXRvcnkxODY4NTMwMDI=",
"slug": "go-team",
"description": "test team",
"privacy": "i dont know",
"url": "https://api.github.com/users/Codertocat",
"html_url": "https://github.com/Codertocat",
"members_url": "http???",
"repositories_url": "http???",
"permission": "???"
}
],
"requested_teams": [],
"labels": [],
"milestone": null,
"commits_url": "https://api.github.com/repos/Codertocat/Hello-World/pulls/2/commits",
Expand Down
81 changes: 7 additions & 74 deletions testdata/github/pull-request.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,86 +39,19 @@
"closed_at": null,
"merged_at": null,
"merge_commit_sha": null,
"assignee": {
"login": "Codertocat6",
"id": 21031067,
"node_id": "MDQ6VXNlcjIxMDMxMDY3",
"avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Codertocat",
"html_url": "https://github.com/Codertocat",
"followers_url": "https://api.github.com/users/Codertocat/followers",
"following_url": "https://api.github.com/users/Codertocat/following{/other_user}",
"gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions",
"organizations_url": "https://api.github.com/users/Codertocat/orgs",
"repos_url": "https://api.github.com/users/Codertocat/repos",
"events_url": "https://api.github.com/users/Codertocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/Codertocat/received_events",
"type": "User",
"site_admin": false
},
"assignee": null,
"assignees": [
{
"login": "Codertocat8",
"id": 21031067,
"node_id": "MDQ6VXNlcjIxMDMxMDY3",
"avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Codertocat",
"html_url": "https://github.com/Codertocat",
"followers_url": "https://api.github.com/users/Codertocat/followers",
"following_url": "https://api.github.com/users/Codertocat/following{/other_user}",
"gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions",
"organizations_url": "https://api.github.com/users/Codertocat/orgs",
"repos_url": "https://api.github.com/users/Codertocat/repos",
"events_url": "https://api.github.com/users/Codertocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/Codertocat/received_events",
"type": "User",
"site_admin": false
}

],
"requested_reviewers": [
{
"login": "Codertocat5",
"id": 21031067,
"node_id": "MDQ6VXNlcjIxMDMxMDY3",
"avatar_url": "https://avatars1.githubusercontent.com/u/21031067?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Codertocat",
"html_url": "https://github.com/Codertocat",
"followers_url": "https://api.github.com/users/Codertocat/followers",
"following_url": "https://api.github.com/users/Codertocat/following{/other_user}",
"gists_url": "https://api.github.com/users/Codertocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Codertocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Codertocat/subscriptions",
"organizations_url": "https://api.github.com/users/Codertocat/orgs",
"repos_url": "https://api.github.com/users/Codertocat/repos",
"events_url": "https://api.github.com/users/Codertocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/Codertocat/received_events",
"type": "User",
"site_admin": false
}

],
"requested_teams": [
{
"name": "go-team",
"id": 123456,
"node_id": "MDEwOlJlcG9zaXRvcnkxODY4NTMwMDI=",
"slug": "go-team",
"description": "test team",
"privacy": "i dont know",
"url": "https://api.github.com/users/Codertocat",
"html_url": "https://github.com/Codertocat",
"members_url": "http???",
"repositories_url": "http???",
"permission": "???"
}

],
"labels": [

],
"labels": [],
"milestone": null,
"commits_url": "https://api.github.com/repos/Codertocat/Hello-World/pulls/2/commits",
"review_comments_url": "https://api.github.com/repos/Codertocat/Hello-World/pulls/2/comments",
Expand Down

0 comments on commit 62af9fc

Please sign in to comment.