{"action":"created","comment":{"url":"https://api.github.com/repos/square/kochiku/pulls/comments/23067095","id":23067095,"diff_hunk":"@@ -177,6 +177,10 @@ def failed?\n     FAILED_STATES.include?(state)\n   end\n \n+  def failed_once?\n+    build_parts.any? { |part| part.build_attempts.unsuccessful.count > 0 }","path":"app/models/build.rb","position":5,"original_position":5,"commit_id":"f7d22a7ebed6afb1e4a8cedffd04b6860728e30c","original_commit_id":"f7d22a7ebed6afb1e4a8cedffd04b6860728e30c","user":{"login":"tamird","id":1535036,"avatar_url":"https://avatars.githubusercontent.com/u/1535036?v=3","gravatar_id":"","url":"https://api.github.com/users/tamird","html_url":"https://github.com/tamird","followers_url":"https://api.github.com/users/tamird/followers","following_url":"https://api.github.com/users/tamird/following{/other_user}","gists_url":"https://api.github.com/users/tamird/gists{/gist_id}","starred_url":"https://api.github.com/users/tamird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tamird/subscriptions","organizations_url":"https://api.github.com/users/tamird/orgs","repos_url":"https://api.github.com/users/tamird/repos","events_url":"https://api.github.com/users/tamird/events{/privacy}","received_events_url":"https://api.github.com/users/tamird/received_events","type":"User","site_admin":false},"body":"nit: `part.build_attempts.unsuccessful.exists?` generates a much more efficient query","created_at":"2015-01-16T08:03:11Z","updated_at":"2015-01-16T08:03:11Z","html_url":"https://github.com/square/kochiku/pull/148#discussion_r23067095","pull_request_url":"https://api.github.com/repos/square/kochiku/pulls/148","_links":{"self":{"href":"https://api.github.com/repos/square/kochiku/pulls/comments/23067095"},"html":{"href":"https://github.com/square/kochiku/pull/148#discussion_r23067095"},"pull_request":{"href":"https://api.github.com/repos/square/kochiku/pulls/148"}}},"pull_request":{"url":"https://api.github.com/repos/square/kochiku/pulls/148","id":27374863,"html_url":"https://github.com/square/kochiku/pull/148","diff_url":"https://github.com/square/kochiku/pull/148.diff","patch_url":"https://github.com/square/kochiku/pull/148.patch","issue_url":"https://api.github.com/repos/square/kochiku/issues/148","number":148,"state":"open","locked":false,"title":"When email on first failure enabled, sends email before retrying","user":{"login":"Shenil","id":3516186,"avatar_url":"https://avatars.githubusercontent.com/u/3516186?v=3","gravatar_id":"","url":"https://api.github.com/users/Shenil","html_url":"https://github.com/Shenil","followers_url":"https://api.github.com/users/Shenil/followers","following_url":"https://api.github.com/users/Shenil/following{/other_user}","gists_url":"https://api.github.com/users/Shenil/gists{/gist_id}","starred_url":"https://api.github.com/users/Shenil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shenil/subscriptions","organizations_url":"https://api.github.com/users/Shenil/orgs","repos_url":"https://api.github.com/users/Shenil/repos","events_url":"https://api.github.com/users/Shenil/events{/privacy}","received_events_url":"https://api.github.com/users/Shenil/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-01-14T19:13:13Z","updated_at":"2015-01-16T08:03:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"99f902ad17007899864d61be15750708e3cd97a0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/square/kochiku/pulls/148/commits","review_comments_url":"https://api.github.com/repos/square/kochiku/pulls/148/comments","review_comment_url":"https://api.github.com/repos/square/kochiku/pulls/comments/{number}","comments_url":"https://api.github.com/repos/square/kochiku/issues/148/comments","statuses_url":"https://api.github.com/repos/square/kochiku/statuses/f7d22a7ebed6afb1e4a8cedffd04b6860728e30c","head":{"label":"square:email_before_retry","ref":"email_before_retry","sha":"f7d22a7ebed6afb1e4a8cedffd04b6860728e30c","user":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"repo":{"id":12229521,"name":"kochiku","full_name":"square/kochiku","owner":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/square/kochiku","description":"Shard your builds for fun and profit","fork":false,"url":"https://api.github.com/repos/square/kochiku","forks_url":"https://api.github.com/repos/square/kochiku/forks","keys_url":"https://api.github.com/repos/square/kochiku/keys{/key_id}","collaborators_url":"https://api.github.com/repos/square/kochiku/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/square/kochiku/teams","hooks_url":"https://api.github.com/repos/square/kochiku/hooks","issue_events_url":"https://api.github.com/repos/square/kochiku/issues/events{/number}","events_url":"https://api.github.com/repos/square/kochiku/events","assignees_url":"https://api.github.com/repos/square/kochiku/assignees{/user}","branches_url":"https://api.github.com/repos/square/kochiku/branches{/branch}","tags_url":"https://api.github.com/repos/square/kochiku/tags","blobs_url":"https://api.github.com/repos/square/kochiku/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/square/kochiku/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/square/kochiku/git/refs{/sha}","trees_url":"https://api.github.com/repos/square/kochiku/git/trees{/sha}","statuses_url":"https://api.github.com/repos/square/kochiku/statuses/{sha}","languages_url":"https://api.github.com/repos/square/kochiku/languages","stargazers_url":"https://api.github.com/repos/square/kochiku/stargazers","contributors_url":"https://api.github.com/repos/square/kochiku/contributors","subscribers_url":"https://api.github.com/repos/square/kochiku/subscribers","subscription_url":"https://api.github.com/repos/square/kochiku/subscription","commits_url":"https://api.github.com/repos/square/kochiku/commits{/sha}","git_commits_url":"https://api.github.com/repos/square/kochiku/git/commits{/sha}","comments_url":"https://api.github.com/repos/square/kochiku/comments{/number}","issue_comment_url":"https://api.github.com/repos/square/kochiku/issues/comments/{number}","contents_url":"https://api.github.com/repos/square/kochiku/contents/{+path}","compare_url":"https://api.github.com/repos/square/kochiku/compare/{base}...{head}","merges_url":"https://api.github.com/repos/square/kochiku/merges","archive_url":"https://api.github.com/repos/square/kochiku/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/square/kochiku/downloads","issues_url":"https://api.github.com/repos/square/kochiku/issues{/number}","pulls_url":"https://api.github.com/repos/square/kochiku/pulls{/number}","milestones_url":"https://api.github.com/repos/square/kochiku/milestones{/number}","notifications_url":"https://api.github.com/repos/square/kochiku/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/square/kochiku/labels{/name}","releases_url":"https://api.github.com/repos/square/kochiku/releases{/id}","created_at":"2013-08-19T22:53:02Z","updated_at":"2015-01-08T01:45:44Z","pushed_at":"2015-01-14T19:12:37Z","git_url":"git://github.com/square/kochiku.git","ssh_url":"git@github.com:square/kochiku.git","clone_url":"https://github.com/square/kochiku.git","svn_url":"https://github.com/square/kochiku","homepage":null,"size":5151,"stargazers_count":406,"watchers_count":406,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":13,"forks":24,"open_issues":13,"watchers":406,"default_branch":"master"}},"base":{"label":"square:master","ref":"master","sha":"4fa9ffcde4943e3c55b84f01eadf00543d2d92d7","user":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"repo":{"id":12229521,"name":"kochiku","full_name":"square/kochiku","owner":{"login":"square","id":82592,"avatar_url":"https://avatars.githubusercontent.com/u/82592?v=3","gravatar_id":"","url":"https://api.github.com/users/square","html_url":"https://github.com/square","followers_url":"https://api.github.com/users/square/followers","following_url":"https://api.github.com/users/square/following{/other_user}","gists_url":"https://api.github.com/users/square/gists{/gist_id}","starred_url":"https://api.github.com/users/square/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/square/subscriptions","organizations_url":"https://api.github.com/users/square/orgs","repos_url":"https://api.github.com/users/square/repos","events_url":"https://api.github.com/users/square/events{/privacy}","received_events_url":"https://api.github.com/users/square/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/square/kochiku","description":"Shard your builds for fun and profit","fork":false,"url":"https://api.github.com/repos/square/kochiku","forks_url":"https://api.github.com/repos/square/kochiku/forks","keys_url":"https://api.github.com/repos/square/kochiku/keys{/key_id}","collaborators_url":"https://api.github.com/repos/square/kochiku/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/square/kochiku/teams","hooks_url":"https://api.github.com/repos/square/kochiku/hooks","issue_events_url":"https://api.github.com/repos/square/kochiku/issues/events{/number}","events_url":"https://api.github.com/repos/square/kochiku/events","assignees_url":"https://api.github.com/repos/square/kochiku/assignees{/user}","branches_url":"https://api.github.com/repos/square/kochiku/branches{/branch}","tags_url":"https://api.github.com/repos/square/kochiku/tags","blobs_url":"https://api.github.com/repos/square/kochiku/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/square/kochiku/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/square/kochiku/git/refs{/sha}","trees_url":"https://api.github.com/repos/square/kochiku/git/trees{/sha}","statuses_url":"https://api.github.com/repos/square/kochiku/statuses/{sha}","languages_url":"https://api.github.com/repos/square/kochiku/languages","stargazers_url":"https://api.github.com/repos/square/kochiku/stargazers","contributors_url":"https://api.github.com/repos/square/kochiku/contributors","subscribers_url":"https://api.github.com/repos/square/kochiku/subscribers","subscription_url":"https://api.github.com/repos/square/kochiku/subscription","commits_url":"https://api.github.com/repos/square/kochiku/commits{/sha}","git_commits_url":"https://api.github.com/repos/square/kochiku/git/commits{/sha}","comments_url":"https://api.github.com/repos/square/kochiku/comments{/number}","issue_comment_url":"https://api.github.com/repos/square/kochiku/issues/comments/{number}","contents_url":"https://api.github.com/repos/square/kochiku/contents/{+path}","compare_url":"https://api.github.com/repos/square/kochiku/compare/{base}...{head}","merges_url":"https://api.github.com/repos/square/kochiku/merges","archive_url":"https://api.github.com/repos/square/kochiku/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/square/kochiku/downloads","issues_url":"https://api.github.com/repos/square/kochiku/issues{/number}","pulls_url":"https://api.github.com/repos/square/kochiku/pulls{/number}","milestones_url":"https://api.github.com/repos/square/kochiku/milestones{/number}","notifications_url":"https://api.github.com/repos/square/kochiku/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/square/kochiku/labels{/name}","releases_url":"https://api.github.com/repos/square/kochiku/releases{/id}","created_at":"2013-08-19T22:53:02Z","updated_at":"2015-01-08T01:45:44Z","pushed_at":"2015-01-14T19:12:37Z","git_url":"git://github.com/square/kochiku.git","ssh_url":"git@github.com:square/kochiku.git","clone_url":"https://github.com/square/kochiku.git","svn_url":"https://github.com/square/kochiku","homepage":null,"size":5151,"stargazers_count":406,"watchers_count":406,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":24,"mirror_url":null,"open_issues_count":13,"forks":24,"open_issues":13,"watchers":406,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/square/kochiku/pulls/148"},"html":{"href":"https://github.com/square/kochiku/pull/148"},"issue":{"href":"https://api.github.com/repos/square/kochiku/issues/148"},"comments":{"href":"https://api.github.com/repos/square/kochiku/issues/148/comments"},"review_comments":{"href":"https://api.github.com/repos/square/kochiku/pulls/148/comments"},"review_comment":{"href":"https://api.github.com/repos/square/kochiku/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/square/kochiku/pulls/148/commits"},"statuses":{"href":"https://api.github.com/repos/square/kochiku/statuses/f7d22a7ebed6afb1e4a8cedffd04b6860728e30c"}}}}