{"action":"created","comment":{"url":"https://api.github.com/repos/joomla/jissues/pulls/comments/23900372","id":23900372,"diff_hunk":"@@ -333,4 +339,133 @@ private function updateGitHub($issueNumber, array $data, $state, $oldState)\n \n \t\treturn $this;\n \t}\n+\n+\t/**\n+\t * Add the status as label on GitHub.\n+\t *\n+\t * The method gets the list of current labels and remove all labels that starts with `~`\n+\t * as it is the status prefix, after this the method add the new status label\n+\t *\n+\t * @param   integer  $issueNumber  The issue number.\n+\t * @param   string   $newlabel     The new label that should be added as label.\n+\t *\n+\t * @throws \\Exception\n+\t * @throws \\JTracker\\Github\\Exception\\GithubException\n+\t *\n+\t *\n+\t * @return  $this\n+\t *\n+\t * @since   1.0\n+\t */\n+\tprivate function addLabelToGitHub($issueNumber, $newlabel)\n+\t{\n+\t\t/* @type \\JTracker\\Application $application */\n+\t\t$application = $this->getContainer()->get('app');\n+\n+\t\t// Get the labels for the pull's issue\n+\t\ttry\n+\t\t{\n+\t\t\t$labels = $github->issues->get($project->gh_user, $project->gh_project, $issueNumber)->labels;\n+\t\t}\n+\t\tcatch (\\DomainException $e)\n+\t\t{\n+\t\t\t$application->enqueueMessage(\n+\t\t\t\tsprintf(\n+\t\t\t\t\t'Error retrieving labels for GitHub item %s/%s #%d - %s',\n+\t\t\t\t\t$project->gh_user,\n+\t\t\t\t\t$project->gh_project,\n+\t\t\t\t\t$issueNumber,\n+\t\t\t\t\t$e->getMessage()\n+\t\t\t\t),\n+\t\t\t\t'error'\n+\t\t\t);\n+\n+\t\t\treturn;\n+\t\t}\n+\n+\t\t// Check if we have any label\n+\t\tif (count($labels) > 0)\n+\t\t{\n+\t\t\tforeach ($labels as $label)\n+\t\t\t{\n+\t\t\t\tif ($label->name == $new_label)\n+\t\t\t\t{\n+\t\t\t\t\t$LabelIsSet = true;\n+\t\t\t\t}\n+\n+\t\t\t\t$prefix = substr($label->name, 0, 1);\n+\n+\t\t\t\tif ($prefix == '~')","path":"src/App/Tracker/Controller/Issue/Save.php","position":73,"original_position":73,"commit_id":"ff23ba93bdfc3602d5e0d7357043222c53dc518a","original_commit_id":"ff23ba93bdfc3602d5e0d7357043222c53dc518a","user":{"login":"b2z","id":3051676,"avatar_url":"https://avatars.githubusercontent.com/u/3051676?v=3","gravatar_id":"","url":"https://api.github.com/users/b2z","html_url":"https://github.com/b2z","followers_url":"https://api.github.com/users/b2z/followers","following_url":"https://api.github.com/users/b2z/following{/other_user}","gists_url":"https://api.github.com/users/b2z/gists{/gist_id}","starred_url":"https://api.github.com/users/b2z/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/b2z/subscriptions","organizations_url":"https://api.github.com/users/b2z/orgs","repos_url":"https://api.github.com/users/b2z/repos","events_url":"https://api.github.com/users/b2z/events{/privacy}","received_events_url":"https://api.github.com/users/b2z/received_events","type":"User","site_admin":false},"body":"Why you remove the label here? You should do it only if the label is not set. Currently you delete any founded label with `~` prefix.","created_at":"2015-02-01T19:35:46Z","updated_at":"2015-02-01T19:35:46Z","html_url":"https://github.com/joomla/jissues/pull/598#discussion_r23900372","pull_request_url":"https://api.github.com/repos/joomla/jissues/pulls/598","_links":{"self":{"href":"https://api.github.com/repos/joomla/jissues/pulls/comments/23900372"},"html":{"href":"https://github.com/joomla/jissues/pull/598#discussion_r23900372"},"pull_request":{"href":"https://api.github.com/repos/joomla/jissues/pulls/598"}}},"pull_request":{"url":"https://api.github.com/repos/joomla/jissues/pulls/598","id":28395621,"html_url":"https://github.com/joomla/jissues/pull/598","diff_url":"https://github.com/joomla/jissues/pull/598.diff","patch_url":"https://github.com/joomla/jissues/pull/598.patch","issue_url":"https://api.github.com/repos/joomla/jissues/issues/598","number":598,"state":"open","locked":false,"title":"Add the label that match to the current issue state (POC)","user":{"login":"zero-24","id":2596554,"avatar_url":"https://avatars.githubusercontent.com/u/2596554?v=3","gravatar_id":"","url":"https://api.github.com/users/zero-24","html_url":"https://github.com/zero-24","followers_url":"https://api.github.com/users/zero-24/followers","following_url":"https://api.github.com/users/zero-24/following{/other_user}","gists_url":"https://api.github.com/users/zero-24/gists{/gist_id}","starred_url":"https://api.github.com/users/zero-24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zero-24/subscriptions","organizations_url":"https://api.github.com/users/zero-24/orgs","repos_url":"https://api.github.com/users/zero-24/repos","events_url":"https://api.github.com/users/zero-24/events{/privacy}","received_events_url":"https://api.github.com/users/zero-24/received_events","type":"User","site_admin":false},"body":"Based on https://github.com/joomla/jissues/commit/08be5c5be7f612778c7930be96dde9eed925b7b9 this will add some code that do it generaly for all status that we have on jissues. This will run on every save action and add the status as label on github. (Ref https://github.com/joomla/jissues/issues/318)\r\n\r\nI hope @b2z @mbabker or @elkuku can have a look into the code and the questions \r\n\r\n### Open questions\r\n\r\n- do we need to create the label bevor adding it via the `$github->issues->labels->add(` function or will this done automatic?\r\n- here: https://github.com/joomla/jissues/commit/08be5c5be7f612778c7930be96dde9eed925b7b9 we use some logger messages. How can i add a new logger instance or is this not needed?","created_at":"2015-01-30T21:43:06Z","updated_at":"2015-02-01T19:35:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5c8d046e8b58c1ff235cf7cc58aa36161d3c9623","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/joomla/jissues/pulls/598/commits","review_comments_url":"https://api.github.com/repos/joomla/jissues/pulls/598/comments","review_comment_url":"https://api.github.com/repos/joomla/jissues/pulls/comments/{number}","comments_url":"https://api.github.com/repos/joomla/jissues/issues/598/comments","statuses_url":"https://api.github.com/repos/joomla/jissues/statuses/ff23ba93bdfc3602d5e0d7357043222c53dc518a","head":{"label":"zero-24:patch-1","ref":"patch-1","sha":"ff23ba93bdfc3602d5e0d7357043222c53dc518a","user":{"login":"zero-24","id":2596554,"avatar_url":"https://avatars.githubusercontent.com/u/2596554?v=3","gravatar_id":"","url":"https://api.github.com/users/zero-24","html_url":"https://github.com/zero-24","followers_url":"https://api.github.com/users/zero-24/followers","following_url":"https://api.github.com/users/zero-24/following{/other_user}","gists_url":"https://api.github.com/users/zero-24/gists{/gist_id}","starred_url":"https://api.github.com/users/zero-24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zero-24/subscriptions","organizations_url":"https://api.github.com/users/zero-24/orgs","repos_url":"https://api.github.com/users/zero-24/repos","events_url":"https://api.github.com/users/zero-24/events{/privacy}","received_events_url":"https://api.github.com/users/zero-24/received_events","type":"User","site_admin":false},"repo":{"id":22654833,"name":"jissues","full_name":"zero-24/jissues","owner":{"login":"zero-24","id":2596554,"avatar_url":"https://avatars.githubusercontent.com/u/2596554?v=3","gravatar_id":"","url":"https://api.github.com/users/zero-24","html_url":"https://github.com/zero-24","followers_url":"https://api.github.com/users/zero-24/followers","following_url":"https://api.github.com/users/zero-24/following{/other_user}","gists_url":"https://api.github.com/users/zero-24/gists{/gist_id}","starred_url":"https://api.github.com/users/zero-24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zero-24/subscriptions","organizations_url":"https://api.github.com/users/zero-24/orgs","repos_url":"https://api.github.com/users/zero-24/repos","events_url":"https://api.github.com/users/zero-24/events{/privacy}","received_events_url":"https://api.github.com/users/zero-24/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zero-24/jissues","description":"Issue Tracking application integrating with GitHub to replace the existing Joomlacode solution.","fork":true,"url":"https://api.github.com/repos/zero-24/jissues","forks_url":"https://api.github.com/repos/zero-24/jissues/forks","keys_url":"https://api.github.com/repos/zero-24/jissues/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zero-24/jissues/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zero-24/jissues/teams","hooks_url":"https://api.github.com/repos/zero-24/jissues/hooks","issue_events_url":"https://api.github.com/repos/zero-24/jissues/issues/events{/number}","events_url":"https://api.github.com/repos/zero-24/jissues/events","assignees_url":"https://api.github.com/repos/zero-24/jissues/assignees{/user}","branches_url":"https://api.github.com/repos/zero-24/jissues/branches{/branch}","tags_url":"https://api.github.com/repos/zero-24/jissues/tags","blobs_url":"https://api.github.com/repos/zero-24/jissues/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zero-24/jissues/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zero-24/jissues/git/refs{/sha}","trees_url":"https://api.github.com/repos/zero-24/jissues/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zero-24/jissues/statuses/{sha}","languages_url":"https://api.github.com/repos/zero-24/jissues/languages","stargazers_url":"https://api.github.com/repos/zero-24/jissues/stargazers","contributors_url":"https://api.github.com/repos/zero-24/jissues/contributors","subscribers_url":"https://api.github.com/repos/zero-24/jissues/subscribers","subscription_url":"https://api.github.com/repos/zero-24/jissues/subscription","commits_url":"https://api.github.com/repos/zero-24/jissues/commits{/sha}","git_commits_url":"https://api.github.com/repos/zero-24/jissues/git/commits{/sha}","comments_url":"https://api.github.com/repos/zero-24/jissues/comments{/number}","issue_comment_url":"https://api.github.com/repos/zero-24/jissues/issues/comments/{number}","contents_url":"https://api.github.com/repos/zero-24/jissues/contents/{+path}","compare_url":"https://api.github.com/repos/zero-24/jissues/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zero-24/jissues/merges","archive_url":"https://api.github.com/repos/zero-24/jissues/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zero-24/jissues/downloads","issues_url":"https://api.github.com/repos/zero-24/jissues/issues{/number}","pulls_url":"https://api.github.com/repos/zero-24/jissues/pulls{/number}","milestones_url":"https://api.github.com/repos/zero-24/jissues/milestones{/number}","notifications_url":"https://api.github.com/repos/zero-24/jissues/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zero-24/jissues/labels{/name}","releases_url":"https://api.github.com/repos/zero-24/jissues/releases{/id}","created_at":"2014-08-05T18:33:39Z","updated_at":"2014-08-05T18:51:53Z","pushed_at":"2015-02-01T19:02:51Z","git_url":"git://github.com/zero-24/jissues.git","ssh_url":"git@github.com:zero-24/jissues.git","clone_url":"https://github.com/zero-24/jissues.git","svn_url":"https://github.com/zero-24/jissues","homepage":"https://plus.google.com/u/0/communities/102541713885101375024","size":13612,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":true,"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":"joomla:master","ref":"master","sha":"75f39784f517cf33d58255557be84cdd33e2c1c8","user":{"login":"joomla","id":751633,"avatar_url":"https://avatars.githubusercontent.com/u/751633?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla","html_url":"https://github.com/joomla","followers_url":"https://api.github.com/users/joomla/followers","following_url":"https://api.github.com/users/joomla/following{/other_user}","gists_url":"https://api.github.com/users/joomla/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla/subscriptions","organizations_url":"https://api.github.com/users/joomla/orgs","repos_url":"https://api.github.com/users/joomla/repos","events_url":"https://api.github.com/users/joomla/events{/privacy}","received_events_url":"https://api.github.com/users/joomla/received_events","type":"Organization","site_admin":false},"repo":{"id":6099080,"name":"jissues","full_name":"joomla/jissues","owner":{"login":"joomla","id":751633,"avatar_url":"https://avatars.githubusercontent.com/u/751633?v=3","gravatar_id":"","url":"https://api.github.com/users/joomla","html_url":"https://github.com/joomla","followers_url":"https://api.github.com/users/joomla/followers","following_url":"https://api.github.com/users/joomla/following{/other_user}","gists_url":"https://api.github.com/users/joomla/gists{/gist_id}","starred_url":"https://api.github.com/users/joomla/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joomla/subscriptions","organizations_url":"https://api.github.com/users/joomla/orgs","repos_url":"https://api.github.com/users/joomla/repos","events_url":"https://api.github.com/users/joomla/events{/privacy}","received_events_url":"https://api.github.com/users/joomla/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/joomla/jissues","description":"Issue Tracking application integrating with GitHub to replace the existing Joomlacode solution.","fork":false,"url":"https://api.github.com/repos/joomla/jissues","forks_url":"https://api.github.com/repos/joomla/jissues/forks","keys_url":"https://api.github.com/repos/joomla/jissues/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joomla/jissues/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joomla/jissues/teams","hooks_url":"https://api.github.com/repos/joomla/jissues/hooks","issue_events_url":"https://api.github.com/repos/joomla/jissues/issues/events{/number}","events_url":"https://api.github.com/repos/joomla/jissues/events","assignees_url":"https://api.github.com/repos/joomla/jissues/assignees{/user}","branches_url":"https://api.github.com/repos/joomla/jissues/branches{/branch}","tags_url":"https://api.github.com/repos/joomla/jissues/tags","blobs_url":"https://api.github.com/repos/joomla/jissues/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joomla/jissues/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joomla/jissues/git/refs{/sha}","trees_url":"https://api.github.com/repos/joomla/jissues/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joomla/jissues/statuses/{sha}","languages_url":"https://api.github.com/repos/joomla/jissues/languages","stargazers_url":"https://api.github.com/repos/joomla/jissues/stargazers","contributors_url":"https://api.github.com/repos/joomla/jissues/contributors","subscribers_url":"https://api.github.com/repos/joomla/jissues/subscribers","subscription_url":"https://api.github.com/repos/joomla/jissues/subscription","commits_url":"https://api.github.com/repos/joomla/jissues/commits{/sha}","git_commits_url":"https://api.github.com/repos/joomla/jissues/git/commits{/sha}","comments_url":"https://api.github.com/repos/joomla/jissues/comments{/number}","issue_comment_url":"https://api.github.com/repos/joomla/jissues/issues/comments/{number}","contents_url":"https://api.github.com/repos/joomla/jissues/contents/{+path}","compare_url":"https://api.github.com/repos/joomla/jissues/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joomla/jissues/merges","archive_url":"https://api.github.com/repos/joomla/jissues/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joomla/jissues/downloads","issues_url":"https://api.github.com/repos/joomla/jissues/issues{/number}","pulls_url":"https://api.github.com/repos/joomla/jissues/pulls{/number}","milestones_url":"https://api.github.com/repos/joomla/jissues/milestones{/number}","notifications_url":"https://api.github.com/repos/joomla/jissues/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joomla/jissues/labels{/name}","releases_url":"https://api.github.com/repos/joomla/jissues/releases{/id}","created_at":"2012-10-06T02:12:43Z","updated_at":"2015-02-01T19:05:00Z","pushed_at":"2015-02-01T19:04:58Z","git_url":"git://github.com/joomla/jissues.git","ssh_url":"git@github.com:joomla/jissues.git","clone_url":"https://github.com/joomla/jissues.git","svn_url":"https://github.com/joomla/jissues","homepage":"","size":18620,"stargazers_count":48,"watchers_count":48,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":48,"mirror_url":null,"open_issues_count":56,"forks":48,"open_issues":56,"watchers":48,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/joomla/jissues/pulls/598"},"html":{"href":"https://github.com/joomla/jissues/pull/598"},"issue":{"href":"https://api.github.com/repos/joomla/jissues/issues/598"},"comments":{"href":"https://api.github.com/repos/joomla/jissues/issues/598/comments"},"review_comments":{"href":"https://api.github.com/repos/joomla/jissues/pulls/598/comments"},"review_comment":{"href":"https://api.github.com/repos/joomla/jissues/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/joomla/jissues/pulls/598/commits"},"statuses":{"href":"https://api.github.com/repos/joomla/jissues/statuses/ff23ba93bdfc3602d5e0d7357043222c53dc518a"}}}}