{"action":"created","comment":{"url":"https://api.github.com/repos/openfaas/openfaas-cloud/pulls/comments/214681405","pull_request_review_id":151787501,"id":214681405,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDY4MTQwNQ==","diff_hunk":"@@ -153,6 +169,118 @@ func reportStatus(status string, desc string, statusContext string, event *sdk.E\n \treturn nil\n }\n \n+func reportCheck(commitStatus *sdk.CommitStatus, event *sdk.Event) error {\n+\tctx := context.Background()\n+\n+\tstatus := commitStatus.Status\n+\turl := buildPublicStatusURL(commitStatus.Status, commitStatus.Context, event)\n+\n+\tlog.Printf(\"Check: %s, Context: %s, GitHub AppID: %d, Repo: %s, Owner: %s\", status, commitStatus.Context, event.InstallationID, event.Repository, event.Owner)\n+\n+\tclient := auth.MakeClient(ctx, token)\n+\n+\tnow := github.Timestamp{time.Now()}\n+\n+\tlogs, err := getLogs(commitStatus, event)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\tchecks, _, _ := client.Checks.ListCheckRunsForRef(ctx, event.Owner, event.Repository, event.SHA, &github.ListCheckRunsOptions{CheckName: &commitStatus.Context})\n+\n+\tcheckRunStatus := getCheckRunStatus(&status)","path":"github-status/handler.go","position":114,"original_position":114,"commit_id":"443cac04a979295ac08d2b6e8537ab3a37620bfa","original_commit_id":"443cac04a979295ac08d2b6e8537ab3a37620bfa","user":{"login":"s8sg","id":7374058,"node_id":"MDQ6VXNlcjczNzQwNTg=","avatar_url":"https://avatars2.githubusercontent.com/u/7374058?v=4","gravatar_id":"","url":"https://api.github.com/users/s8sg","html_url":"https://github.com/s8sg","followers_url":"https://api.github.com/users/s8sg/followers","following_url":"https://api.github.com/users/s8sg/following{/other_user}","gists_url":"https://api.github.com/users/s8sg/gists{/gist_id}","starred_url":"https://api.github.com/users/s8sg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/s8sg/subscriptions","organizations_url":"https://api.github.com/users/s8sg/orgs","repos_url":"https://api.github.com/users/s8sg/repos","events_url":"https://api.github.com/users/s8sg/events{/privacy}","received_events_url":"https://api.github.com/users/s8sg/received_events","type":"User","site_admin":false},"body":"By convention a pass by reference denotes that the method will change the object, but here its not the case. I don’t see any problem with doing this way except it introduces a chance of nil pointer dereferance while testing the function separately.  ","created_at":"2018-09-03T12:56:06Z","updated_at":"2018-09-03T12:56:06Z","html_url":"https://github.com/openfaas/openfaas-cloud/pull/114#discussion_r214681405","pull_request_url":"https://api.github.com/repos/openfaas/openfaas-cloud/pulls/114","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/openfaas/openfaas-cloud/pulls/comments/214681405"},"html":{"href":"https://github.com/openfaas/openfaas-cloud/pull/114#discussion_r214681405"},"pull_request":{"href":"https://api.github.com/repos/openfaas/openfaas-cloud/pulls/114"}},"in_reply_to_id":213888713},"pull_request":{"url":"https://api.github.com/repos/openfaas/openfaas-cloud/pulls/114","id":210905673,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEwOTA1Njcz","html_url":"https://github.com/openfaas/openfaas-cloud/pull/114","diff_url":"https://github.com/openfaas/openfaas-cloud/pull/114.diff","patch_url":"https://github.com/openfaas/openfaas-cloud/pull/114.patch","issue_url":"https://api.github.com/repos/openfaas/openfaas-cloud/issues/114","number":114,"state":"open","locked":false,"title":"Report status to github Checks API with logs","user":{"login":"kvuchkov","id":6725218,"node_id":"MDQ6VXNlcjY3MjUyMTg=","avatar_url":"https://avatars2.githubusercontent.com/u/6725218?v=4","gravatar_id":"","url":"https://api.github.com/users/kvuchkov","html_url":"https://github.com/kvuchkov","followers_url":"https://api.github.com/users/kvuchkov/followers","following_url":"https://api.github.com/users/kvuchkov/following{/other_user}","gists_url":"https://api.github.com/users/kvuchkov/gists{/gist_id}","starred_url":"https://api.github.com/users/kvuchkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kvuchkov/subscriptions","organizations_url":"https://api.github.com/users/kvuchkov/orgs","repos_url":"https://api.github.com/users/kvuchkov/repos","events_url":"https://api.github.com/users/kvuchkov/events{/privacy}","received_events_url":"https://api.github.com/users/kvuchkov/received_events","type":"User","site_admin":false},"body":"github-status function is already coupled with github. Github offer a much richer API than the Status API. Checks API allows to provide rich information about a perticular status directly in the github UI, making it much more easier for developers to look through logs and pull requests for functions.\r\n\r\nNow statuses are reported with additional details - the build logs.\r\n\r\nThe change is contained within the github-status function and is abstracted away from the rest of the openfaas-cloud.\r\n\r\nSigned-off-by: Kiril Vuchkov <kirilvuchkov@gmail.com>\r\n\r\n## Description\r\n\r\nThis is implementation for issue #107 Report status to Github via Checks API.\r\n\r\n## How Has This Been Tested?\r\nI have a repo https://github.com/kvuchkov/test-github-app1 with 2 go functions that I used for development and testing.\r\n\r\nTried the following scenarios:\r\n* Breaking 1/2 function \r\n* Fixing both functions\r\n* Breaking both functions\r\n\r\n## Checklist:\r\n\r\nI have:\r\n\r\n- [x] updated the documentation if required\r\n- [x] read the [CONTRIBUTION](https://github.com/openfaas/faas/blob/master/CONTRIBUTING.md) guide\r\n- [x] signed-off my commits with `git commit -s`\r\n- [x] added unit tests","created_at":"2018-08-25T14:43:49Z","updated_at":"2018-09-03T12:56:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f8a5672443a488cd3b1ac084740b466f1b670cd6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/openfaas/openfaas-cloud/pulls/114/commits","review_comments_url":"https://api.github.com/repos/openfaas/openfaas-cloud/pulls/114/comments","review_comment_url":"https://api.github.com/repos/openfaas/openfaas-cloud/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openfaas/openfaas-cloud/issues/114/comments","statuses_url":"https://api.github.com/repos/openfaas/openfaas-cloud/statuses/443cac04a979295ac08d2b6e8537ab3a37620bfa","head":{"label":"kvuchkov:report-status-to-check-api-with-logs","ref":"report-status-to-check-api-with-logs","sha":"443cac04a979295ac08d2b6e8537ab3a37620bfa","user":{"login":"kvuchkov","id":6725218,"node_id":"MDQ6VXNlcjY3MjUyMTg=","avatar_url":"https://avatars2.githubusercontent.com/u/6725218?v=4","gravatar_id":"","url":"https://api.github.com/users/kvuchkov","html_url":"https://github.com/kvuchkov","followers_url":"https://api.github.com/users/kvuchkov/followers","following_url":"https://api.github.com/users/kvuchkov/following{/other_user}","gists_url":"https://api.github.com/users/kvuchkov/gists{/gist_id}","starred_url":"https://api.github.com/users/kvuchkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kvuchkov/subscriptions","organizations_url":"https://api.github.com/users/kvuchkov/orgs","repos_url":"https://api.github.com/users/kvuchkov/repos","events_url":"https://api.github.com/users/kvuchkov/events{/privacy}","received_events_url":"https://api.github.com/users/kvuchkov/received_events","type":"User","site_admin":false},"repo":{"id":145381039,"node_id":"MDEwOlJlcG9zaXRvcnkxNDUzODEwMzk=","name":"openfaas-cloud","full_name":"kvuchkov/openfaas-cloud","owner":{"login":"kvuchkov","id":6725218,"node_id":"MDQ6VXNlcjY3MjUyMTg=","avatar_url":"https://avatars2.githubusercontent.com/u/6725218?v=4","gravatar_id":"","url":"https://api.github.com/users/kvuchkov","html_url":"https://github.com/kvuchkov","followers_url":"https://api.github.com/users/kvuchkov/followers","following_url":"https://api.github.com/users/kvuchkov/following{/other_user}","gists_url":"https://api.github.com/users/kvuchkov/gists{/gist_id}","starred_url":"https://api.github.com/users/kvuchkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kvuchkov/subscriptions","organizations_url":"https://api.github.com/users/kvuchkov/orgs","repos_url":"https://api.github.com/users/kvuchkov/repos","events_url":"https://api.github.com/users/kvuchkov/events{/privacy}","received_events_url":"https://api.github.com/users/kvuchkov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kvuchkov/openfaas-cloud","description":"OpenFaaS Cloud - GitOps for your functions with native GitHub integrations","fork":true,"url":"https://api.github.com/repos/kvuchkov/openfaas-cloud","forks_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/forks","keys_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/teams","hooks_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/hooks","issue_events_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/issues/events{/number}","events_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/events","assignees_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/assignees{/user}","branches_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/branches{/branch}","tags_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/tags","blobs_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/git/refs{/sha}","trees_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/statuses/{sha}","languages_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/languages","stargazers_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/stargazers","contributors_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/contributors","subscribers_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/subscribers","subscription_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/subscription","commits_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/commits{/sha}","git_commits_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/git/commits{/sha}","comments_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/comments{/number}","issue_comment_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/issues/comments{/number}","contents_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/contents/{+path}","compare_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/merges","archive_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/downloads","issues_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/issues{/number}","pulls_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/pulls{/number}","milestones_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/milestones{/number}","notifications_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/labels{/name}","releases_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/releases{/id}","deployments_url":"https://api.github.com/repos/kvuchkov/openfaas-cloud/deployments","created_at":"2018-08-20T07:18:17Z","updated_at":"2018-08-20T07:18:19Z","pushed_at":"2018-08-29T05:12:08Z","git_url":"git://github.com/kvuchkov/openfaas-cloud.git","ssh_url":"git@github.com:kvuchkov/openfaas-cloud.git","clone_url":"https://github.com/kvuchkov/openfaas-cloud.git","svn_url":"https://github.com/kvuchkov/openfaas-cloud","homepage":"https://blog.alexellis.io/introducing-openfaas-cloud/","size":12495,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openfaas:master","ref":"master","sha":"c7b1f535b99776f2d79bb3f1662c1552639e68a1","user":{"login":"openfaas","id":27013154,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3MDEzMTU0","avatar_url":"https://avatars3.githubusercontent.com/u/27013154?v=4","gravatar_id":"","url":"https://api.github.com/users/openfaas","html_url":"https://github.com/openfaas","followers_url":"https://api.github.com/users/openfaas/followers","following_url":"https://api.github.com/users/openfaas/following{/other_user}","gists_url":"https://api.github.com/users/openfaas/gists{/gist_id}","starred_url":"https://api.github.com/users/openfaas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openfaas/subscriptions","organizations_url":"https://api.github.com/users/openfaas/orgs","repos_url":"https://api.github.com/users/openfaas/repos","events_url":"https://api.github.com/users/openfaas/events{/privacy}","received_events_url":"https://api.github.com/users/openfaas/received_events","type":"Organization","site_admin":false},"repo":{"id":109512938,"node_id":"MDEwOlJlcG9zaXRvcnkxMDk1MTI5Mzg=","name":"openfaas-cloud","full_name":"openfaas/openfaas-cloud","owner":{"login":"openfaas","id":27013154,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3MDEzMTU0","avatar_url":"https://avatars3.githubusercontent.com/u/27013154?v=4","gravatar_id":"","url":"https://api.github.com/users/openfaas","html_url":"https://github.com/openfaas","followers_url":"https://api.github.com/users/openfaas/followers","following_url":"https://api.github.com/users/openfaas/following{/other_user}","gists_url":"https://api.github.com/users/openfaas/gists{/gist_id}","starred_url":"https://api.github.com/users/openfaas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openfaas/subscriptions","organizations_url":"https://api.github.com/users/openfaas/orgs","repos_url":"https://api.github.com/users/openfaas/repos","events_url":"https://api.github.com/users/openfaas/events{/privacy}","received_events_url":"https://api.github.com/users/openfaas/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openfaas/openfaas-cloud","description":"OpenFaaS Cloud - GitOps for your functions with native GitHub integrations","fork":false,"url":"https://api.github.com/repos/openfaas/openfaas-cloud","forks_url":"https://api.github.com/repos/openfaas/openfaas-cloud/forks","keys_url":"https://api.github.com/repos/openfaas/openfaas-cloud/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openfaas/openfaas-cloud/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openfaas/openfaas-cloud/teams","hooks_url":"https://api.github.com/repos/openfaas/openfaas-cloud/hooks","issue_events_url":"https://api.github.com/repos/openfaas/openfaas-cloud/issues/events{/number}","events_url":"https://api.github.com/repos/openfaas/openfaas-cloud/events","assignees_url":"https://api.github.com/repos/openfaas/openfaas-cloud/assignees{/user}","branches_url":"https://api.github.com/repos/openfaas/openfaas-cloud/branches{/branch}","tags_url":"https://api.github.com/repos/openfaas/openfaas-cloud/tags","blobs_url":"https://api.github.com/repos/openfaas/openfaas-cloud/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openfaas/openfaas-cloud/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openfaas/openfaas-cloud/git/refs{/sha}","trees_url":"https://api.github.com/repos/openfaas/openfaas-cloud/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openfaas/openfaas-cloud/statuses/{sha}","languages_url":"https://api.github.com/repos/openfaas/openfaas-cloud/languages","stargazers_url":"https://api.github.com/repos/openfaas/openfaas-cloud/stargazers","contributors_url":"https://api.github.com/repos/openfaas/openfaas-cloud/contributors","subscribers_url":"https://api.github.com/repos/openfaas/openfaas-cloud/subscribers","subscription_url":"https://api.github.com/repos/openfaas/openfaas-cloud/subscription","commits_url":"https://api.github.com/repos/openfaas/openfaas-cloud/commits{/sha}","git_commits_url":"https://api.github.com/repos/openfaas/openfaas-cloud/git/commits{/sha}","comments_url":"https://api.github.com/repos/openfaas/openfaas-cloud/comments{/number}","issue_comment_url":"https://api.github.com/repos/openfaas/openfaas-cloud/issues/comments{/number}","contents_url":"https://api.github.com/repos/openfaas/openfaas-cloud/contents/{+path}","compare_url":"https://api.github.com/repos/openfaas/openfaas-cloud/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openfaas/openfaas-cloud/merges","archive_url":"https://api.github.com/repos/openfaas/openfaas-cloud/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openfaas/openfaas-cloud/downloads","issues_url":"https://api.github.com/repos/openfaas/openfaas-cloud/issues{/number}","pulls_url":"https://api.github.com/repos/openfaas/openfaas-cloud/pulls{/number}","milestones_url":"https://api.github.com/repos/openfaas/openfaas-cloud/milestones{/number}","notifications_url":"https://api.github.com/repos/openfaas/openfaas-cloud/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openfaas/openfaas-cloud/labels{/name}","releases_url":"https://api.github.com/repos/openfaas/openfaas-cloud/releases{/id}","deployments_url":"https://api.github.com/repos/openfaas/openfaas-cloud/deployments","created_at":"2017-11-04T16:54:15Z","updated_at":"2018-09-03T11:37:10Z","pushed_at":"2018-09-03T11:37:07Z","git_url":"git://github.com/openfaas/openfaas-cloud.git","ssh_url":"git@github.com:openfaas/openfaas-cloud.git","clone_url":"https://github.com/openfaas/openfaas-cloud.git","svn_url":"https://github.com/openfaas/openfaas-cloud","homepage":"https://blog.alexellis.io/introducing-openfaas-cloud/","size":12462,"stargazers_count":99,"watchers_count":99,"language":"Go","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"archived":false,"open_issues_count":22,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":20,"open_issues":22,"watchers":99,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openfaas/openfaas-cloud/pulls/114"},"html":{"href":"https://github.com/openfaas/openfaas-cloud/pull/114"},"issue":{"href":"https://api.github.com/repos/openfaas/openfaas-cloud/issues/114"},"comments":{"href":"https://api.github.com/repos/openfaas/openfaas-cloud/issues/114/comments"},"review_comments":{"href":"https://api.github.com/repos/openfaas/openfaas-cloud/pulls/114/comments"},"review_comment":{"href":"https://api.github.com/repos/openfaas/openfaas-cloud/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openfaas/openfaas-cloud/pulls/114/commits"},"statuses":{"href":"https://api.github.com/repos/openfaas/openfaas-cloud/statuses/443cac04a979295ac08d2b6e8537ab3a37620bfa"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"s8sg"}}