{"action":"created","comment":{"url":"https://api.github.com/repos/atomist/automation-client/pulls/comments/233023139","pull_request_review_id":174343199,"id":233023139,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzAyMzEzOQ==","diff_hunk":"@@ -0,0 +1,157 @@\n+import * as url from \"url\";\n+import {\n+    ActionResult,\n+    successOn,\n+} from \"../../action/ActionResult\";\n+import { Configurable } from \"../../project/git/Configurable\";\n+import { DefaultHttpClientFactory } from \"../../spi/http/axiosHttpClient\";\n+import { HttpMethod } from \"../../spi/http/httpClient\";\n+import { logger } from \"../../util/logger\";\n+import { AbstractRemoteRepoRef } from \"./AbstractRemoteRepoRef\";\n+import { GitlabPrivateTokenCredentials } from \"./GitlabPrivateTokenCredentials\";\n+import { GitShaRegExp } from \"./params/validationPatterns\";\n+import { ProjectOperationCredentials } from \"./ProjectOperationCredentials\";\n+import { ProviderType } from \"./RepoId\";\n+\n+export const GitlabDotComApiBase = \"https://gitlab.com/api/v4\";\n+export const GitlabDotComRemoteUrl = \"https://gitlab.com/\";\n+\n+/**\n+ * Repository reference implementation for Gitlab\n+ */\n+export class GitlabRepoRef extends AbstractRemoteRepoRef {\n+\n+    public static from(params: {\n+        owner: string,\n+        repo: string,\n+        sha?: string,\n+        rawApiBase?: string,\n+        path?: string,\n+        gitlabRemoteUrl?: string,\n+        branch?: string,\n+    }): GitlabRepoRef {\n+        if (params.sha && !params.sha.match(GitShaRegExp.pattern)) {\n+            throw new Error(\"You provided an invalid SHA: \" + params.sha);\n+        }\n+        const result = new GitlabRepoRef(params.owner, params.repo, params.sha, params.rawApiBase, params.gitlabRemoteUrl, params.path);\n+        result.branch = params.branch;\n+        return result;\n+    }\n+\n+    private constructor(owner: string,\n+                        repo: string,\n+                        sha: string,\n+                        public apiBase = GitlabDotComApiBase,\n+                        gitlabRemoteUrl: string = GitlabDotComRemoteUrl,\n+                        path?: string) {\n+        super(apiBase === GitlabDotComApiBase ? ProviderType.gitlab_com : ProviderType.gitlab_enterprise,\n+            gitlabRemoteUrl,\n+            apiBase,\n+            owner,\n+            repo,\n+            sha,\n+            path);\n+    }\n+\n+    public async createRemote(creds: ProjectOperationCredentials, description: string, visibility): Promise<ActionResult<this>> {\n+\n+        const gitlabUrl = this.concatUrl(this.apiBase, `projects`);\n+        const httpClient = DefaultHttpClientFactory.create();\n+        return httpClient.exchange(gitlabUrl, {\n+            method: HttpMethod.Post,\n+            body: {\n+                name: `${this.repo}`,\n+                visibility,\n+            },\n+            headers: {\n+                \"Private-Token\": (creds as GitlabPrivateTokenCredentials).privateToken,\n+                \"Content-Type\": \"application/json\",\n+            },\n+\n+        }).then(axiosResponse => {","path":"lib/operations/common/GitlabRepoRef.ts","position":71,"original_position":71,"commit_id":"87276736e56533ae235dd36fa7335906ca9ea91a","original_commit_id":"87276736e56533ae235dd36fa7335906ca9ea91a","user":{"login":"cdupuis","id":206707,"node_id":"MDQ6VXNlcjIwNjcwNw==","avatar_url":"https://avatars3.githubusercontent.com/u/206707?v=4","gravatar_id":"","url":"https://api.github.com/users/cdupuis","html_url":"https://github.com/cdupuis","followers_url":"https://api.github.com/users/cdupuis/followers","following_url":"https://api.github.com/users/cdupuis/following{/other_user}","gists_url":"https://api.github.com/users/cdupuis/gists{/gist_id}","starred_url":"https://api.github.com/users/cdupuis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdupuis/subscriptions","organizations_url":"https://api.github.com/users/cdupuis/orgs","repos_url":"https://api.github.com/users/cdupuis/repos","events_url":"https://api.github.com/users/cdupuis/events{/privacy}","received_events_url":"https://api.github.com/users/cdupuis/received_events","type":"User","site_admin":false},"body":"axios?","created_at":"2018-11-13T12:49:07Z","updated_at":"2018-11-13T12:51:36Z","html_url":"https://github.com/atomist/automation-client/pull/399#discussion_r233023139","pull_request_url":"https://api.github.com/repos/atomist/automation-client/pulls/399","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/atomist/automation-client/pulls/comments/233023139"},"html":{"href":"https://github.com/atomist/automation-client/pull/399#discussion_r233023139"},"pull_request":{"href":"https://api.github.com/repos/atomist/automation-client/pulls/399"}}},"pull_request":{"url":"https://api.github.com/repos/atomist/automation-client/pulls/399","id":229326812,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5MzI2ODEy","html_url":"https://github.com/atomist/automation-client/pull/399","diff_url":"https://github.com/atomist/automation-client/pull/399.diff","patch_url":"https://github.com/atomist/automation-client/pull/399.patch","issue_url":"https://api.github.com/repos/atomist/automation-client/issues/399","number":399,"state":"open","locked":false,"title":"Add initial Gitlab support","user":{"login":"lievendoclo","id":218316,"node_id":"MDQ6VXNlcjIxODMxNg==","avatar_url":"https://avatars0.githubusercontent.com/u/218316?v=4","gravatar_id":"","url":"https://api.github.com/users/lievendoclo","html_url":"https://github.com/lievendoclo","followers_url":"https://api.github.com/users/lievendoclo/followers","following_url":"https://api.github.com/users/lievendoclo/following{/other_user}","gists_url":"https://api.github.com/users/lievendoclo/gists{/gist_id}","starred_url":"https://api.github.com/users/lievendoclo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lievendoclo/subscriptions","organizations_url":"https://api.github.com/users/lievendoclo/orgs","repos_url":"https://api.github.com/users/lievendoclo/repos","events_url":"https://api.github.com/users/lievendoclo/events{/privacy}","received_events_url":"https://api.github.com/users/lievendoclo/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-11-08T11:04:47Z","updated_at":"2018-11-13T12:51:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a8af1a576c1b13a23f7b28787a7b7a264ed369a1","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1031793459,"node_id":"MDU6TGFiZWwxMDMxNzkzNDU5","url":"https://api.github.com/repos/atomist/automation-client/labels/auto-merge:on-approve","name":"auto-merge:on-approve","color":"277D7D","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/atomist/automation-client/pulls/399/commits","review_comments_url":"https://api.github.com/repos/atomist/automation-client/pulls/399/comments","review_comment_url":"https://api.github.com/repos/atomist/automation-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/atomist/automation-client/issues/399/comments","statuses_url":"https://api.github.com/repos/atomist/automation-client/statuses/87276736e56533ae235dd36fa7335906ca9ea91a","head":{"label":"atomist:gitlab-support","ref":"gitlab-support","sha":"87276736e56533ae235dd36fa7335906ca9ea91a","user":{"login":"atomist","id":19392,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5Mzky","avatar_url":"https://avatars3.githubusercontent.com/u/19392?v=4","gravatar_id":"","url":"https://api.github.com/users/atomist","html_url":"https://github.com/atomist","followers_url":"https://api.github.com/users/atomist/followers","following_url":"https://api.github.com/users/atomist/following{/other_user}","gists_url":"https://api.github.com/users/atomist/gists{/gist_id}","starred_url":"https://api.github.com/users/atomist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atomist/subscriptions","organizations_url":"https://api.github.com/users/atomist/orgs","repos_url":"https://api.github.com/users/atomist/repos","events_url":"https://api.github.com/users/atomist/events{/privacy}","received_events_url":"https://api.github.com/users/atomist/received_events","type":"Organization","site_admin":false},"repo":{"id":103996800,"node_id":"MDEwOlJlcG9zaXRvcnkxMDM5OTY4MDA=","name":"automation-client","full_name":"atomist/automation-client","private":false,"owner":{"login":"atomist","id":19392,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5Mzky","avatar_url":"https://avatars3.githubusercontent.com/u/19392?v=4","gravatar_id":"","url":"https://api.github.com/users/atomist","html_url":"https://github.com/atomist","followers_url":"https://api.github.com/users/atomist/followers","following_url":"https://api.github.com/users/atomist/following{/other_user}","gists_url":"https://api.github.com/users/atomist/gists{/gist_id}","starred_url":"https://api.github.com/users/atomist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atomist/subscriptions","organizations_url":"https://api.github.com/users/atomist/orgs","repos_url":"https://api.github.com/users/atomist/repos","events_url":"https://api.github.com/users/atomist/events{/privacy}","received_events_url":"https://api.github.com/users/atomist/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/atomist/automation-client","description":"Automation client for running command and events handlers against the Atomist API.","fork":false,"url":"https://api.github.com/repos/atomist/automation-client","forks_url":"https://api.github.com/repos/atomist/automation-client/forks","keys_url":"https://api.github.com/repos/atomist/automation-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/atomist/automation-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/atomist/automation-client/teams","hooks_url":"https://api.github.com/repos/atomist/automation-client/hooks","issue_events_url":"https://api.github.com/repos/atomist/automation-client/issues/events{/number}","events_url":"https://api.github.com/repos/atomist/automation-client/events","assignees_url":"https://api.github.com/repos/atomist/automation-client/assignees{/user}","branches_url":"https://api.github.com/repos/atomist/automation-client/branches{/branch}","tags_url":"https://api.github.com/repos/atomist/automation-client/tags","blobs_url":"https://api.github.com/repos/atomist/automation-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/atomist/automation-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/atomist/automation-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/atomist/automation-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/atomist/automation-client/statuses/{sha}","languages_url":"https://api.github.com/repos/atomist/automation-client/languages","stargazers_url":"https://api.github.com/repos/atomist/automation-client/stargazers","contributors_url":"https://api.github.com/repos/atomist/automation-client/contributors","subscribers_url":"https://api.github.com/repos/atomist/automation-client/subscribers","subscription_url":"https://api.github.com/repos/atomist/automation-client/subscription","commits_url":"https://api.github.com/repos/atomist/automation-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/atomist/automation-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/atomist/automation-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/atomist/automation-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/atomist/automation-client/contents/{+path}","compare_url":"https://api.github.com/repos/atomist/automation-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/atomist/automation-client/merges","archive_url":"https://api.github.com/repos/atomist/automation-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/atomist/automation-client/downloads","issues_url":"https://api.github.com/repos/atomist/automation-client/issues{/number}","pulls_url":"https://api.github.com/repos/atomist/automation-client/pulls{/number}","milestones_url":"https://api.github.com/repos/atomist/automation-client/milestones{/number}","notifications_url":"https://api.github.com/repos/atomist/automation-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/atomist/automation-client/labels{/name}","releases_url":"https://api.github.com/repos/atomist/automation-client/releases{/id}","deployments_url":"https://api.github.com/repos/atomist/automation-client/deployments","created_at":"2017-09-18T22:06:21Z","updated_at":"2018-11-10T13:25:46Z","pushed_at":"2018-11-10T13:29:49Z","git_url":"git://github.com/atomist/automation-client.git","ssh_url":"git@github.com:atomist/automation-client.git","clone_url":"https://github.com/atomist/automation-client.git","svn_url":"https://github.com/atomist/automation-client","homepage":"","size":7068,"stargazers_count":11,"watchers_count":11,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":34,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":8,"open_issues":34,"watchers":11,"default_branch":"master"}},"base":{"label":"atomist:master","ref":"master","sha":"ef0fc953c6e4a670cdf6c5d1d9e582f5ba7244cd","user":{"login":"atomist","id":19392,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5Mzky","avatar_url":"https://avatars3.githubusercontent.com/u/19392?v=4","gravatar_id":"","url":"https://api.github.com/users/atomist","html_url":"https://github.com/atomist","followers_url":"https://api.github.com/users/atomist/followers","following_url":"https://api.github.com/users/atomist/following{/other_user}","gists_url":"https://api.github.com/users/atomist/gists{/gist_id}","starred_url":"https://api.github.com/users/atomist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atomist/subscriptions","organizations_url":"https://api.github.com/users/atomist/orgs","repos_url":"https://api.github.com/users/atomist/repos","events_url":"https://api.github.com/users/atomist/events{/privacy}","received_events_url":"https://api.github.com/users/atomist/received_events","type":"Organization","site_admin":false},"repo":{"id":103996800,"node_id":"MDEwOlJlcG9zaXRvcnkxMDM5OTY4MDA=","name":"automation-client","full_name":"atomist/automation-client","private":false,"owner":{"login":"atomist","id":19392,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE5Mzky","avatar_url":"https://avatars3.githubusercontent.com/u/19392?v=4","gravatar_id":"","url":"https://api.github.com/users/atomist","html_url":"https://github.com/atomist","followers_url":"https://api.github.com/users/atomist/followers","following_url":"https://api.github.com/users/atomist/following{/other_user}","gists_url":"https://api.github.com/users/atomist/gists{/gist_id}","starred_url":"https://api.github.com/users/atomist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/atomist/subscriptions","organizations_url":"https://api.github.com/users/atomist/orgs","repos_url":"https://api.github.com/users/atomist/repos","events_url":"https://api.github.com/users/atomist/events{/privacy}","received_events_url":"https://api.github.com/users/atomist/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/atomist/automation-client","description":"Automation client for running command and events handlers against the Atomist API.","fork":false,"url":"https://api.github.com/repos/atomist/automation-client","forks_url":"https://api.github.com/repos/atomist/automation-client/forks","keys_url":"https://api.github.com/repos/atomist/automation-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/atomist/automation-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/atomist/automation-client/teams","hooks_url":"https://api.github.com/repos/atomist/automation-client/hooks","issue_events_url":"https://api.github.com/repos/atomist/automation-client/issues/events{/number}","events_url":"https://api.github.com/repos/atomist/automation-client/events","assignees_url":"https://api.github.com/repos/atomist/automation-client/assignees{/user}","branches_url":"https://api.github.com/repos/atomist/automation-client/branches{/branch}","tags_url":"https://api.github.com/repos/atomist/automation-client/tags","blobs_url":"https://api.github.com/repos/atomist/automation-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/atomist/automation-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/atomist/automation-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/atomist/automation-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/atomist/automation-client/statuses/{sha}","languages_url":"https://api.github.com/repos/atomist/automation-client/languages","stargazers_url":"https://api.github.com/repos/atomist/automation-client/stargazers","contributors_url":"https://api.github.com/repos/atomist/automation-client/contributors","subscribers_url":"https://api.github.com/repos/atomist/automation-client/subscribers","subscription_url":"https://api.github.com/repos/atomist/automation-client/subscription","commits_url":"https://api.github.com/repos/atomist/automation-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/atomist/automation-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/atomist/automation-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/atomist/automation-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/atomist/automation-client/contents/{+path}","compare_url":"https://api.github.com/repos/atomist/automation-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/atomist/automation-client/merges","archive_url":"https://api.github.com/repos/atomist/automation-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/atomist/automation-client/downloads","issues_url":"https://api.github.com/repos/atomist/automation-client/issues{/number}","pulls_url":"https://api.github.com/repos/atomist/automation-client/pulls{/number}","milestones_url":"https://api.github.com/repos/atomist/automation-client/milestones{/number}","notifications_url":"https://api.github.com/repos/atomist/automation-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/atomist/automation-client/labels{/name}","releases_url":"https://api.github.com/repos/atomist/automation-client/releases{/id}","deployments_url":"https://api.github.com/repos/atomist/automation-client/deployments","created_at":"2017-09-18T22:06:21Z","updated_at":"2018-11-10T13:25:46Z","pushed_at":"2018-11-10T13:29:49Z","git_url":"git://github.com/atomist/automation-client.git","ssh_url":"git@github.com:atomist/automation-client.git","clone_url":"https://github.com/atomist/automation-client.git","svn_url":"https://github.com/atomist/automation-client","homepage":"","size":7068,"stargazers_count":11,"watchers_count":11,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":8,"mirror_url":null,"archived":false,"open_issues_count":34,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":8,"open_issues":34,"watchers":11,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/atomist/automation-client/pulls/399"},"html":{"href":"https://github.com/atomist/automation-client/pull/399"},"issue":{"href":"https://api.github.com/repos/atomist/automation-client/issues/399"},"comments":{"href":"https://api.github.com/repos/atomist/automation-client/issues/399/comments"},"review_comments":{"href":"https://api.github.com/repos/atomist/automation-client/pulls/399/comments"},"review_comment":{"href":"https://api.github.com/repos/atomist/automation-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/atomist/automation-client/pulls/399/commits"},"statuses":{"href":"https://api.github.com/repos/atomist/automation-client/statuses/87276736e56533ae235dd36fa7335906ca9ea91a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"cdupuis"}}