{"action":"created","comment":{"url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/pulls/comments/231037327","pull_request_review_id":171909778,"id":231037327,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMTAzNzMyNw==","diff_hunk":"@@ -0,0 +1,94 @@\n+/*********************************************************************\n+ * Copyright (c) 2018 Red Hat, Inc.\n+ *\n+ * This program and the accompanying materials are made\n+ * available under the terms of the Eclipse Public License 2.0\n+ * which is available at https://www.eclipse.org/legal/epl-2.0/\n+ *\n+ * SPDX-License-Identifier: EPL-2.0\n+ **********************************************************************/\n+\n+import * as theia from '@theia/plugin';\n+import { GithubServiceImpl } from './node/github-service-impl';\n+import { WsMasterHttpClient } from './node/ws-master-http-client';\n+import { Credentials, SshKeyPair } from './common/github-model';\n+\n+const githubService = new GithubServiceImpl();\n+\n+let credentials: Credentials;\n+\n+export function start(context: theia.PluginContext) {\n+    const GENERATE_AND_UPLOAD: theia.Command = {\n+        id: 'github:generate_and_upload',\n+        label: 'GitHub: Generate Ssh key and upload it to GitHub ...'\n+    };\n+    const AUTHENTICATE: theia.Command = {\n+        id: 'github:authenticate',\n+        label: 'GitHub: Authenticate ...'\n+    };\n+\n+    context.subscriptions.push(\n+        theia.commands.registerCommand(GENERATE_AND_UPLOAD, async () => {\n+            if (credentials) {\n+                uploadSshKey(credentials);\n+            } else {\n+                await authenticate();\n+                uploadSshKey(credentials);\n+            }\n+        })\n+    );\n+    context.subscriptions.push(\n+        theia.commands.registerCommand(AUTHENTICATE, () => {\n+            authenticate();\n+        })\n+    );\n+}\n+\n+async function uploadSshKey(credentials: Credentials): Promise<void> {\n+    const publicKey = await getOrGenerateSshKey();\n+    try {\n+        if (publicKey) {\n+            await githubService.uploadSshKey(credentials, 'theia', publicKey);\n+            theia.window.showInformationMessage('Public SSH key was successfully uploaded to GitHub');\n+        }\n+    } catch (error) {\n+        theia.window.showErrorMessage(JSON.parse(error.message).message);\n+    }\n+}\n+\n+async function getOrGenerateSshKey(): Promise<string | undefined> {\n+    const cheApi = await theia.env.getEnvVariable('CHE_API');","path":"src/che-theia-github-plugin-backend-plugin.ts","position":58,"original_position":60,"commit_id":"1d3d9f648110497dbbecf1f361f8d0560eee95fb","original_commit_id":"50e7faac5006fa38278d54e1ab671ff49f58b525","user":{"login":"vinokurig","id":7668752,"node_id":"MDQ6VXNlcjc2Njg3NTI=","avatar_url":"https://avatars1.githubusercontent.com/u/7668752?v=4","gravatar_id":"","url":"https://api.github.com/users/vinokurig","html_url":"https://github.com/vinokurig","followers_url":"https://api.github.com/users/vinokurig/followers","following_url":"https://api.github.com/users/vinokurig/following{/other_user}","gists_url":"https://api.github.com/users/vinokurig/gists{/gist_id}","starred_url":"https://api.github.com/users/vinokurig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinokurig/subscriptions","organizations_url":"https://api.github.com/users/vinokurig/orgs","repos_url":"https://api.github.com/users/vinokurig/repos","events_url":"https://api.github.com/users/vinokurig/events{/privacy}","received_events_url":"https://api.github.com/users/vinokurig/received_events","type":"User","site_admin":false},"body":"This env variable is used in `che-theia-ssh-plugin` as well, so it shouldn't be renamed.","created_at":"2018-11-06T08:45:59Z","updated_at":"2018-11-06T08:45:59Z","html_url":"https://github.com/eclipse/che-theia-github-plugin/pull/6#discussion_r231037327","pull_request_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/pulls/6","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/eclipse/che-theia-github-plugin/pulls/comments/231037327"},"html":{"href":"https://github.com/eclipse/che-theia-github-plugin/pull/6#discussion_r231037327"},"pull_request":{"href":"https://api.github.com/repos/eclipse/che-theia-github-plugin/pulls/6"}},"in_reply_to_id":230334178},"pull_request":{"url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/pulls/6","id":226918782,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI2OTE4Nzgy","html_url":"https://github.com/eclipse/che-theia-github-plugin/pull/6","diff_url":"https://github.com/eclipse/che-theia-github-plugin/pull/6.diff","patch_url":"https://github.com/eclipse/che-theia-github-plugin/pull/6.patch","issue_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/issues/6","number":6,"state":"open","locked":false,"title":"Rework to plug-in","user":{"login":"vinokurig","id":7668752,"node_id":"MDQ6VXNlcjc2Njg3NTI=","avatar_url":"https://avatars1.githubusercontent.com/u/7668752?v=4","gravatar_id":"","url":"https://api.github.com/users/vinokurig","html_url":"https://github.com/vinokurig","followers_url":"https://api.github.com/users/vinokurig/followers","following_url":"https://api.github.com/users/vinokurig/following{/other_user}","gists_url":"https://api.github.com/users/vinokurig/gists{/gist_id}","starred_url":"https://api.github.com/users/vinokurig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinokurig/subscriptions","organizations_url":"https://api.github.com/users/vinokurig/orgs","repos_url":"https://api.github.com/users/vinokurig/repos","events_url":"https://api.github.com/users/vinokurig/events{/privacy}","received_events_url":"https://api.github.com/users/vinokurig/received_events","type":"User","site_admin":false},"body":"fixes https://github.com/eclipse/che/issues/11457","created_at":"2018-10-30T13:21:47Z","updated_at":"2018-11-06T08:45:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"17e980f2c3140d2a55c8de688fb74bc57ab09db0","assignee":null,"assignees":[],"requested_reviewers":[{"login":"evidolob","id":929743,"node_id":"MDQ6VXNlcjkyOTc0Mw==","avatar_url":"https://avatars0.githubusercontent.com/u/929743?v=4","gravatar_id":"","url":"https://api.github.com/users/evidolob","html_url":"https://github.com/evidolob","followers_url":"https://api.github.com/users/evidolob/followers","following_url":"https://api.github.com/users/evidolob/following{/other_user}","gists_url":"https://api.github.com/users/evidolob/gists{/gist_id}","starred_url":"https://api.github.com/users/evidolob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/evidolob/subscriptions","organizations_url":"https://api.github.com/users/evidolob/orgs","repos_url":"https://api.github.com/users/evidolob/repos","events_url":"https://api.github.com/users/evidolob/events{/privacy}","received_events_url":"https://api.github.com/users/evidolob/received_events","type":"User","site_admin":false},{"login":"vparfonov","id":1636592,"node_id":"MDQ6VXNlcjE2MzY1OTI=","avatar_url":"https://avatars1.githubusercontent.com/u/1636592?v=4","gravatar_id":"","url":"https://api.github.com/users/vparfonov","html_url":"https://github.com/vparfonov","followers_url":"https://api.github.com/users/vparfonov/followers","following_url":"https://api.github.com/users/vparfonov/following{/other_user}","gists_url":"https://api.github.com/users/vparfonov/gists{/gist_id}","starred_url":"https://api.github.com/users/vparfonov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vparfonov/subscriptions","organizations_url":"https://api.github.com/users/vparfonov/orgs","repos_url":"https://api.github.com/users/vparfonov/repos","events_url":"https://api.github.com/users/vparfonov/events{/privacy}","received_events_url":"https://api.github.com/users/vparfonov/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/pulls/6/commits","review_comments_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/pulls/6/comments","review_comment_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/issues/6/comments","statuses_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/statuses/1d3d9f648110497dbbecf1f361f8d0560eee95fb","head":{"label":"eclipse:CHE-11457","ref":"CHE-11457","sha":"1d3d9f648110497dbbecf1f361f8d0560eee95fb","user":{"login":"eclipse","id":56974,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2OTc0","avatar_url":"https://avatars1.githubusercontent.com/u/56974?v=4","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"repo":{"id":122395566,"node_id":"MDEwOlJlcG9zaXRvcnkxMjIzOTU1NjY=","name":"che-theia-github-plugin","full_name":"eclipse/che-theia-github-plugin","private":false,"owner":{"login":"eclipse","id":56974,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2OTc0","avatar_url":"https://avatars1.githubusercontent.com/u/56974?v=4","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/eclipse/che-theia-github-plugin","description":"che-theia-github-plugin","fork":false,"url":"https://api.github.com/repos/eclipse/che-theia-github-plugin","forks_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/forks","keys_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/teams","hooks_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/hooks","issue_events_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/events","assignees_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/tags","blobs_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/languages","stargazers_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/stargazers","contributors_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/contributors","subscribers_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/subscribers","subscription_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/subscription","commits_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/merges","archive_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/downloads","issues_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/labels{/name}","releases_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/deployments","created_at":"2018-02-21T21:25:27Z","updated_at":"2018-10-02T15:24:00Z","pushed_at":"2018-11-05T13:18:14Z","git_url":"git://github.com/eclipse/che-theia-github-plugin.git","ssh_url":"git@github.com:eclipse/che-theia-github-plugin.git","clone_url":"https://github.com/eclipse/che-theia-github-plugin.git","svn_url":"https://github.com/eclipse/che-theia-github-plugin","homepage":null,"size":92,"stargazers_count":1,"watchers_count":1,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"epl-2.0","name":"Eclipse Public License 2.0","spdx_id":"EPL-2.0","url":"https://api.github.com/licenses/epl-2.0","node_id":"MDc6TGljZW5zZTMy"},"forks":3,"open_issues":3,"watchers":1,"default_branch":"master"}},"base":{"label":"eclipse:master","ref":"master","sha":"c42d69d27562e35f9644832e4c20f43fe8f3e97b","user":{"login":"eclipse","id":56974,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2OTc0","avatar_url":"https://avatars1.githubusercontent.com/u/56974?v=4","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"repo":{"id":122395566,"node_id":"MDEwOlJlcG9zaXRvcnkxMjIzOTU1NjY=","name":"che-theia-github-plugin","full_name":"eclipse/che-theia-github-plugin","private":false,"owner":{"login":"eclipse","id":56974,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU2OTc0","avatar_url":"https://avatars1.githubusercontent.com/u/56974?v=4","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/eclipse/che-theia-github-plugin","description":"che-theia-github-plugin","fork":false,"url":"https://api.github.com/repos/eclipse/che-theia-github-plugin","forks_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/forks","keys_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/teams","hooks_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/hooks","issue_events_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/issues/events{/number}","events_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/events","assignees_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/assignees{/user}","branches_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/branches{/branch}","tags_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/tags","blobs_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/git/refs{/sha}","trees_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/statuses/{sha}","languages_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/languages","stargazers_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/stargazers","contributors_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/contributors","subscribers_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/subscribers","subscription_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/subscription","commits_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/commits{/sha}","git_commits_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/git/commits{/sha}","comments_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/comments{/number}","issue_comment_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/issues/comments{/number}","contents_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/contents/{+path}","compare_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/merges","archive_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/downloads","issues_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/issues{/number}","pulls_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/pulls{/number}","milestones_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/milestones{/number}","notifications_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/labels{/name}","releases_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/releases{/id}","deployments_url":"https://api.github.com/repos/eclipse/che-theia-github-plugin/deployments","created_at":"2018-02-21T21:25:27Z","updated_at":"2018-10-02T15:24:00Z","pushed_at":"2018-11-05T13:18:14Z","git_url":"git://github.com/eclipse/che-theia-github-plugin.git","ssh_url":"git@github.com:eclipse/che-theia-github-plugin.git","clone_url":"https://github.com/eclipse/che-theia-github-plugin.git","svn_url":"https://github.com/eclipse/che-theia-github-plugin","homepage":null,"size":92,"stargazers_count":1,"watchers_count":1,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"epl-2.0","name":"Eclipse Public License 2.0","spdx_id":"EPL-2.0","url":"https://api.github.com/licenses/epl-2.0","node_id":"MDc6TGljZW5zZTMy"},"forks":3,"open_issues":3,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eclipse/che-theia-github-plugin/pulls/6"},"html":{"href":"https://github.com/eclipse/che-theia-github-plugin/pull/6"},"issue":{"href":"https://api.github.com/repos/eclipse/che-theia-github-plugin/issues/6"},"comments":{"href":"https://api.github.com/repos/eclipse/che-theia-github-plugin/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/eclipse/che-theia-github-plugin/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/eclipse/che-theia-github-plugin/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eclipse/che-theia-github-plugin/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/eclipse/che-theia-github-plugin/statuses/1d3d9f648110497dbbecf1f361f8d0560eee95fb"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"vinokurig"}}