{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/miq_bot/pulls/comments/30069782","id":30069782,"diff_hunk":"@@ -32,21 +36,65 @@ def tag\n     \"<gemfile_checker />\"\n   end\n \n+  def label_name\n+    LABEL_NAME\n+  end\n+\n   def process_branch\n     send(\"process_#{branch.pull_request? ? \"pr\" : \"regular\"}_branch\")\n   end\n \n   def process_pr_branch\n-    logger.info(\"#{self.class.name}##{__method__} Updating pull request #{branch.pr_number} with Gemfile comment.\")\n+    @pr = branch.pr_number\n+    logger.info(\"#{self.class.name}##{__method__} Updating pull request #{pr} with Gemfile comment.\")\n \n     branch.repo.with_github_service do |github|\n-      github.issues.comments.create(\n-        :issue_id => branch.pr_number,\n-        :body     => \"#{tag}#{Settings.gemfile_checker.pr_contacts.join(\" \")} Gemfile changes detected in commit #{branch.commit_uri_to(commit)}.  Please review.\"\n-      )\n+      @github = github\n+      delete_pr_comments(pr_gemfile_comments)\n+      add_pr_gemfile_comment\n+      add_pr_label\n     end\n   end\n \n+  def github_org_repo\n+    [branch.repo.upstream_user, branch.repo.name]\n+  end\n+\n+  def add_pr_label\n+    issue_labels = github.issues.labels.list(*github_org_repo, \"issue_id\" => pr)","path":"app/workers/commit_monitor_handlers/commit/gemfile_checker.rb","position":62,"original_position":62,"commit_id":"884dbab07416c9b2dc0e6ca0dbd28b2ad2cf0253","original_commit_id":"884dbab07416c9b2dc0e6ca0dbd28b2ad2cf0253","user":{"login":"Fryguy","id":52120,"avatar_url":"https://avatars.githubusercontent.com/u/52120?v=3","gravatar_id":"","url":"https://api.github.com/users/Fryguy","html_url":"https://github.com/Fryguy","followers_url":"https://api.github.com/users/Fryguy/followers","following_url":"https://api.github.com/users/Fryguy/following{/other_user}","gists_url":"https://api.github.com/users/Fryguy/gists{/gist_id}","starred_url":"https://api.github.com/users/Fryguy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fryguy/subscriptions","organizations_url":"https://api.github.com/users/Fryguy/orgs","repos_url":"https://api.github.com/users/Fryguy/repos","events_url":"https://api.github.com/users/Fryguy/events{/privacy}","received_events_url":"https://api.github.com/users/Fryguy/received_events","type":"User","site_admin":false},"body":"The branch should be associated with a PR, so you can get the issue first, and then get the labels and not need the repo info I think...Plus the github handle comes from the branch object with *should* already have this info...\r\n\r\nSomething like\r\n\r\n```ruby\r\nissue = github.issues(\"issue_id\" => pr)\r\nissue.labels.list\r\n```","created_at":"2015-05-11T18:53:18Z","updated_at":"2015-05-11T18:53:18Z","html_url":"https://github.com/ManageIQ/miq_bot/pull/54#discussion_r30069782","pull_request_url":"https://api.github.com/repos/ManageIQ/miq_bot/pulls/54","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/miq_bot/pulls/comments/30069782"},"html":{"href":"https://github.com/ManageIQ/miq_bot/pull/54#discussion_r30069782"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/miq_bot/pulls/54"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/miq_bot/pulls/54","id":35060424,"html_url":"https://github.com/ManageIQ/miq_bot/pull/54","diff_url":"https://github.com/ManageIQ/miq_bot/pull/54.diff","patch_url":"https://github.com/ManageIQ/miq_bot/pull/54.patch","issue_url":"https://api.github.com/repos/ManageIQ/miq_bot/issues/54","number":54,"state":"open","locked":false,"title":"Enhance gemfile checker","user":{"login":"jrafanie","id":19339,"avatar_url":"https://avatars.githubusercontent.com/u/19339?v=3","gravatar_id":"","url":"https://api.github.com/users/jrafanie","html_url":"https://github.com/jrafanie","followers_url":"https://api.github.com/users/jrafanie/followers","following_url":"https://api.github.com/users/jrafanie/following{/other_user}","gists_url":"https://api.github.com/users/jrafanie/gists{/gist_id}","starred_url":"https://api.github.com/users/jrafanie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrafanie/subscriptions","organizations_url":"https://api.github.com/users/jrafanie/orgs","repos_url":"https://api.github.com/users/jrafanie/repos","events_url":"https://api.github.com/users/jrafanie/events{/privacy}","received_events_url":"https://api.github.com/users/jrafanie/received_events","type":"User","site_admin":false},"body":"* Configure the repository that GemfileChecker monitors.\r\n  * This makes it easier to test \"ManageIQ/sandbox\" as an example.\r\n* Delete prior Gemfile comments before adding a new one.\r\n* Add the \"gem changes\" label to the PR if it's not already applied.\r\n  * Fixes #3\r\n\r\ncc @Fryguy \r\n\r\nOnce this in, we can extract much of the code that is similar to the rubucop checker that detects the already existing comments.","created_at":"2015-05-09T03:04:40Z","updated_at":"2015-05-11T18:53:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f44d7ea4242f6787bc94193d03d9307750654bf0","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/miq_bot/pulls/54/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/miq_bot/pulls/54/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/miq_bot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/miq_bot/issues/54/comments","statuses_url":"https://api.github.com/repos/ManageIQ/miq_bot/statuses/884dbab07416c9b2dc0e6ca0dbd28b2ad2cf0253","head":{"label":"jrafanie:enhance_gemfile_checker","ref":"enhance_gemfile_checker","sha":"884dbab07416c9b2dc0e6ca0dbd28b2ad2cf0253","user":{"login":"jrafanie","id":19339,"avatar_url":"https://avatars.githubusercontent.com/u/19339?v=3","gravatar_id":"","url":"https://api.github.com/users/jrafanie","html_url":"https://github.com/jrafanie","followers_url":"https://api.github.com/users/jrafanie/followers","following_url":"https://api.github.com/users/jrafanie/following{/other_user}","gists_url":"https://api.github.com/users/jrafanie/gists{/gist_id}","starred_url":"https://api.github.com/users/jrafanie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrafanie/subscriptions","organizations_url":"https://api.github.com/users/jrafanie/orgs","repos_url":"https://api.github.com/users/jrafanie/repos","events_url":"https://api.github.com/users/jrafanie/events{/privacy}","received_events_url":"https://api.github.com/users/jrafanie/received_events","type":"User","site_admin":false},"repo":{"id":35279590,"name":"miq_bot","full_name":"jrafanie/miq_bot","owner":{"login":"jrafanie","id":19339,"avatar_url":"https://avatars.githubusercontent.com/u/19339?v=3","gravatar_id":"","url":"https://api.github.com/users/jrafanie","html_url":"https://github.com/jrafanie","followers_url":"https://api.github.com/users/jrafanie/followers","following_url":"https://api.github.com/users/jrafanie/following{/other_user}","gists_url":"https://api.github.com/users/jrafanie/gists{/gist_id}","starred_url":"https://api.github.com/users/jrafanie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jrafanie/subscriptions","organizations_url":"https://api.github.com/users/jrafanie/orgs","repos_url":"https://api.github.com/users/jrafanie/repos","events_url":"https://api.github.com/users/jrafanie/events{/privacy}","received_events_url":"https://api.github.com/users/jrafanie/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jrafanie/miq_bot","description":"ManageIQ Bot","fork":true,"url":"https://api.github.com/repos/jrafanie/miq_bot","forks_url":"https://api.github.com/repos/jrafanie/miq_bot/forks","keys_url":"https://api.github.com/repos/jrafanie/miq_bot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jrafanie/miq_bot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jrafanie/miq_bot/teams","hooks_url":"https://api.github.com/repos/jrafanie/miq_bot/hooks","issue_events_url":"https://api.github.com/repos/jrafanie/miq_bot/issues/events{/number}","events_url":"https://api.github.com/repos/jrafanie/miq_bot/events","assignees_url":"https://api.github.com/repos/jrafanie/miq_bot/assignees{/user}","branches_url":"https://api.github.com/repos/jrafanie/miq_bot/branches{/branch}","tags_url":"https://api.github.com/repos/jrafanie/miq_bot/tags","blobs_url":"https://api.github.com/repos/jrafanie/miq_bot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jrafanie/miq_bot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jrafanie/miq_bot/git/refs{/sha}","trees_url":"https://api.github.com/repos/jrafanie/miq_bot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jrafanie/miq_bot/statuses/{sha}","languages_url":"https://api.github.com/repos/jrafanie/miq_bot/languages","stargazers_url":"https://api.github.com/repos/jrafanie/miq_bot/stargazers","contributors_url":"https://api.github.com/repos/jrafanie/miq_bot/contributors","subscribers_url":"https://api.github.com/repos/jrafanie/miq_bot/subscribers","subscription_url":"https://api.github.com/repos/jrafanie/miq_bot/subscription","commits_url":"https://api.github.com/repos/jrafanie/miq_bot/commits{/sha}","git_commits_url":"https://api.github.com/repos/jrafanie/miq_bot/git/commits{/sha}","comments_url":"https://api.github.com/repos/jrafanie/miq_bot/comments{/number}","issue_comment_url":"https://api.github.com/repos/jrafanie/miq_bot/issues/comments{/number}","contents_url":"https://api.github.com/repos/jrafanie/miq_bot/contents/{+path}","compare_url":"https://api.github.com/repos/jrafanie/miq_bot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jrafanie/miq_bot/merges","archive_url":"https://api.github.com/repos/jrafanie/miq_bot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jrafanie/miq_bot/downloads","issues_url":"https://api.github.com/repos/jrafanie/miq_bot/issues{/number}","pulls_url":"https://api.github.com/repos/jrafanie/miq_bot/pulls{/number}","milestones_url":"https://api.github.com/repos/jrafanie/miq_bot/milestones{/number}","notifications_url":"https://api.github.com/repos/jrafanie/miq_bot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jrafanie/miq_bot/labels{/name}","releases_url":"https://api.github.com/repos/jrafanie/miq_bot/releases{/id}","created_at":"2015-05-08T13:04:27Z","updated_at":"2015-05-08T13:04:28Z","pushed_at":"2015-05-09T02:58:59Z","git_url":"git://github.com/jrafanie/miq_bot.git","ssh_url":"git@github.com:jrafanie/miq_bot.git","clone_url":"https://github.com/jrafanie/miq_bot.git","svn_url":"https://github.com/jrafanie/miq_bot","homepage":null,"size":285,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ManageIQ:master","ref":"master","sha":"63626ce5f982f53a0dab52baeb13a9bba2529e3e","user":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"repo":{"id":23851775,"name":"miq_bot","full_name":"ManageIQ/miq_bot","owner":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ManageIQ/miq_bot","description":"ManageIQ Bot","fork":false,"url":"https://api.github.com/repos/ManageIQ/miq_bot","forks_url":"https://api.github.com/repos/ManageIQ/miq_bot/forks","keys_url":"https://api.github.com/repos/ManageIQ/miq_bot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManageIQ/miq_bot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManageIQ/miq_bot/teams","hooks_url":"https://api.github.com/repos/ManageIQ/miq_bot/hooks","issue_events_url":"https://api.github.com/repos/ManageIQ/miq_bot/issues/events{/number}","events_url":"https://api.github.com/repos/ManageIQ/miq_bot/events","assignees_url":"https://api.github.com/repos/ManageIQ/miq_bot/assignees{/user}","branches_url":"https://api.github.com/repos/ManageIQ/miq_bot/branches{/branch}","tags_url":"https://api.github.com/repos/ManageIQ/miq_bot/tags","blobs_url":"https://api.github.com/repos/ManageIQ/miq_bot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManageIQ/miq_bot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManageIQ/miq_bot/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManageIQ/miq_bot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManageIQ/miq_bot/statuses/{sha}","languages_url":"https://api.github.com/repos/ManageIQ/miq_bot/languages","stargazers_url":"https://api.github.com/repos/ManageIQ/miq_bot/stargazers","contributors_url":"https://api.github.com/repos/ManageIQ/miq_bot/contributors","subscribers_url":"https://api.github.com/repos/ManageIQ/miq_bot/subscribers","subscription_url":"https://api.github.com/repos/ManageIQ/miq_bot/subscription","commits_url":"https://api.github.com/repos/ManageIQ/miq_bot/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManageIQ/miq_bot/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManageIQ/miq_bot/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManageIQ/miq_bot/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManageIQ/miq_bot/contents/{+path}","compare_url":"https://api.github.com/repos/ManageIQ/miq_bot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManageIQ/miq_bot/merges","archive_url":"https://api.github.com/repos/ManageIQ/miq_bot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManageIQ/miq_bot/downloads","issues_url":"https://api.github.com/repos/ManageIQ/miq_bot/issues{/number}","pulls_url":"https://api.github.com/repos/ManageIQ/miq_bot/pulls{/number}","milestones_url":"https://api.github.com/repos/ManageIQ/miq_bot/milestones{/number}","notifications_url":"https://api.github.com/repos/ManageIQ/miq_bot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManageIQ/miq_bot/labels{/name}","releases_url":"https://api.github.com/repos/ManageIQ/miq_bot/releases{/id}","created_at":"2014-09-09T22:02:14Z","updated_at":"2015-05-02T14:37:13Z","pushed_at":"2015-05-11T08:49:56Z","git_url":"git://github.com/ManageIQ/miq_bot.git","ssh_url":"git@github.com:ManageIQ/miq_bot.git","clone_url":"https://github.com/ManageIQ/miq_bot.git","svn_url":"https://github.com/ManageIQ/miq_bot","homepage":null,"size":693,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":36,"forks":4,"open_issues":36,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/miq_bot/pulls/54"},"html":{"href":"https://github.com/ManageIQ/miq_bot/pull/54"},"issue":{"href":"https://api.github.com/repos/ManageIQ/miq_bot/issues/54"},"comments":{"href":"https://api.github.com/repos/ManageIQ/miq_bot/issues/54/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/miq_bot/pulls/54/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/miq_bot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/miq_bot/pulls/54/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/miq_bot/statuses/884dbab07416c9b2dc0e6ca0dbd28b2ad2cf0253"}}}}