{"action":"created","comment":{"url":"https://api.github.com/repos/hadley/devtools/pulls/comments/65914150","id":65914150,"diff_hunk":"@@ -23,16 +23,51 @@ github_response <- function(req) {\n   parsed\n }\n \n-github_GET <- function(path, ..., pat = github_pat()) {\n+github_GET <- function(path, ..., pat = github_pat(),\n+                       host = \"api.github.com\") {\n+\n+  url <- paste0(\"https://\", host, \"/\")\n+\n+  # if the host contains a path, i.e. \"github.hostname.com/api/v3\",","path":"R/github.R","position":36,"original_position":10,"commit_id":"f0b9cc9b37f2ff8f294754a34088c104a2f6c0ab","original_commit_id":"8f1b784aa1239020bf0a7e03f0a4dd26c1dcb097","user":{"login":"ijlyttle","id":2800934,"avatar_url":"https://avatars.githubusercontent.com/u/2800934?v=3","gravatar_id":"","url":"https://api.github.com/users/ijlyttle","html_url":"https://github.com/ijlyttle","followers_url":"https://api.github.com/users/ijlyttle/followers","following_url":"https://api.github.com/users/ijlyttle/following{/other_user}","gists_url":"https://api.github.com/users/ijlyttle/gists{/gist_id}","starred_url":"https://api.github.com/users/ijlyttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ijlyttle/subscriptions","organizations_url":"https://api.github.com/users/ijlyttle/orgs","repos_url":"https://api.github.com/users/ijlyttle/repos","events_url":"https://api.github.com/users/ijlyttle/events{/privacy}","received_events_url":"https://api.github.com/users/ijlyttle/received_events","type":"User","site_admin":false},"body":"I do this because the endpoint prefix for enterprise Github is different from github.com.\r\n\r\nenterprise: `http(s)://hostname/api/v3/` [ref](https://developer.github.com/v3/enterprise/)\r\ngithub.com: `https://api.github.com` [ref](https://developer.github.com/v3/)\r\n\r\nOf course, this does not mean that stuffing everything into `host` is the right way to do it :)\r\n\r\nJust to spitball on a possible paths forward, I could use two args (with defaults): `host = \"https://api.github.com\"` and `path_prefix = NULL`. To use enterprise github, one could specify \r\n`host = \"https://github.hostname.com\"` and `path_prefix = \"api/v3\"`.\r\n\r\nPlease let me know what you think and I'll change things accordingly.","created_at":"2016-06-06T15:42:18Z","updated_at":"2016-06-06T15:42:18Z","html_url":"https://github.com/hadley/devtools/pull/1142#discussion_r65914150","pull_request_url":"https://api.github.com/repos/hadley/devtools/pulls/1142","_links":{"self":{"href":"https://api.github.com/repos/hadley/devtools/pulls/comments/65914150"},"html":{"href":"https://github.com/hadley/devtools/pull/1142#discussion_r65914150"},"pull_request":{"href":"https://api.github.com/repos/hadley/devtools/pulls/1142"}}},"pull_request":{"url":"https://api.github.com/repos/hadley/devtools/pulls/1142","id":65726563,"html_url":"https://github.com/hadley/devtools/pull/1142","diff_url":"https://github.com/hadley/devtools/pull/1142.diff","patch_url":"https://github.com/hadley/devtools/pull/1142.patch","issue_url":"https://api.github.com/repos/hadley/devtools/issues/1142","number":1142,"state":"open","locked":false,"title":"Adds host argument to `use_github()`","user":{"login":"ijlyttle","id":2800934,"avatar_url":"https://avatars.githubusercontent.com/u/2800934?v=3","gravatar_id":"","url":"https://api.github.com/users/ijlyttle","html_url":"https://github.com/ijlyttle","followers_url":"https://api.github.com/users/ijlyttle/followers","following_url":"https://api.github.com/users/ijlyttle/following{/other_user}","gists_url":"https://api.github.com/users/ijlyttle/gists{/gist_id}","starred_url":"https://api.github.com/users/ijlyttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ijlyttle/subscriptions","organizations_url":"https://api.github.com/users/ijlyttle/orgs","repos_url":"https://api.github.com/users/ijlyttle/repos","events_url":"https://api.github.com/users/ijlyttle/events{/privacy}","received_events_url":"https://api.github.com/users/ijlyttle/received_events","type":"User","site_admin":false},"body":"Addresses #1101\r\n\r\nThis is to let you use this function with an enterprise installation of GitHub.\r\n\r\nThe goal is to have a `host` argument to `use_github()` work in the same way as the host argument to `install_github()`\r\n\r\nHere are my claims:\r\n\r\n- all the tests: `test(filter = \"github\")` remain successful\r\n- `use_github()` remains working for `host = \"api.github.com\"` \r\n- `use_github()` works for `host = \"github.hostname.com/api/v3\"`\r\n\r\nI tested the last two manually - a repository was created at github (public and private), was pushed, and the right thing appears in DESCRIPTION.\r\n\r\nHere's my caveat: in a few places, I went through some contortions to get the right mappings of url's and paths. My goal here was to be clear about the changes I was making - to favor ugly code on the surface to making changes to deeper implementations. In other words, to proscribe what I wanted to happen, but not to try to imagine (yet) the optimal way of making it happen.\r\n\r\nI remain at your service if you think that anything here should be done differently.","created_at":"2016-04-08T01:51:19Z","updated_at":"2016-06-06T15:42:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d0b2a3442f4216ecc897671accbe593698c92778","assignee":null,"milestone":{"url":"https://api.github.com/repos/hadley/devtools/milestones/7","html_url":"https://github.com/hadley/devtools/milestones/1.12.0","labels_url":"https://api.github.com/repos/hadley/devtools/milestones/7/labels","id":1799754,"number":7,"title":"1.12.0","description":"","creator":{"login":"jimhester","id":205275,"avatar_url":"https://avatars.githubusercontent.com/u/205275?v=3","gravatar_id":"","url":"https://api.github.com/users/jimhester","html_url":"https://github.com/jimhester","followers_url":"https://api.github.com/users/jimhester/followers","following_url":"https://api.github.com/users/jimhester/following{/other_user}","gists_url":"https://api.github.com/users/jimhester/gists{/gist_id}","starred_url":"https://api.github.com/users/jimhester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimhester/subscriptions","organizations_url":"https://api.github.com/users/jimhester/orgs","repos_url":"https://api.github.com/users/jimhester/repos","events_url":"https://api.github.com/users/jimhester/events{/privacy}","received_events_url":"https://api.github.com/users/jimhester/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":29,"state":"open","created_at":"2016-05-31T20:37:47Z","updated_at":"2016-06-03T21:19:28Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/hadley/devtools/pulls/1142/commits","review_comments_url":"https://api.github.com/repos/hadley/devtools/pulls/1142/comments","review_comment_url":"https://api.github.com/repos/hadley/devtools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hadley/devtools/issues/1142/comments","statuses_url":"https://api.github.com/repos/hadley/devtools/statuses/f0b9cc9b37f2ff8f294754a34088c104a2f6c0ab","head":{"label":"ijlyttle:use_github_host","ref":"use_github_host","sha":"f0b9cc9b37f2ff8f294754a34088c104a2f6c0ab","user":{"login":"ijlyttle","id":2800934,"avatar_url":"https://avatars.githubusercontent.com/u/2800934?v=3","gravatar_id":"","url":"https://api.github.com/users/ijlyttle","html_url":"https://github.com/ijlyttle","followers_url":"https://api.github.com/users/ijlyttle/followers","following_url":"https://api.github.com/users/ijlyttle/following{/other_user}","gists_url":"https://api.github.com/users/ijlyttle/gists{/gist_id}","starred_url":"https://api.github.com/users/ijlyttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ijlyttle/subscriptions","organizations_url":"https://api.github.com/users/ijlyttle/orgs","repos_url":"https://api.github.com/users/ijlyttle/repos","events_url":"https://api.github.com/users/ijlyttle/events{/privacy}","received_events_url":"https://api.github.com/users/ijlyttle/received_events","type":"User","site_admin":false},"repo":{"id":40909330,"name":"devtools","full_name":"ijlyttle/devtools","owner":{"login":"ijlyttle","id":2800934,"avatar_url":"https://avatars.githubusercontent.com/u/2800934?v=3","gravatar_id":"","url":"https://api.github.com/users/ijlyttle","html_url":"https://github.com/ijlyttle","followers_url":"https://api.github.com/users/ijlyttle/followers","following_url":"https://api.github.com/users/ijlyttle/following{/other_user}","gists_url":"https://api.github.com/users/ijlyttle/gists{/gist_id}","starred_url":"https://api.github.com/users/ijlyttle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ijlyttle/subscriptions","organizations_url":"https://api.github.com/users/ijlyttle/orgs","repos_url":"https://api.github.com/users/ijlyttle/repos","events_url":"https://api.github.com/users/ijlyttle/events{/privacy}","received_events_url":"https://api.github.com/users/ijlyttle/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ijlyttle/devtools","description":"Tools to make an R developer's life easier","fork":true,"url":"https://api.github.com/repos/ijlyttle/devtools","forks_url":"https://api.github.com/repos/ijlyttle/devtools/forks","keys_url":"https://api.github.com/repos/ijlyttle/devtools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ijlyttle/devtools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ijlyttle/devtools/teams","hooks_url":"https://api.github.com/repos/ijlyttle/devtools/hooks","issue_events_url":"https://api.github.com/repos/ijlyttle/devtools/issues/events{/number}","events_url":"https://api.github.com/repos/ijlyttle/devtools/events","assignees_url":"https://api.github.com/repos/ijlyttle/devtools/assignees{/user}","branches_url":"https://api.github.com/repos/ijlyttle/devtools/branches{/branch}","tags_url":"https://api.github.com/repos/ijlyttle/devtools/tags","blobs_url":"https://api.github.com/repos/ijlyttle/devtools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ijlyttle/devtools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ijlyttle/devtools/git/refs{/sha}","trees_url":"https://api.github.com/repos/ijlyttle/devtools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ijlyttle/devtools/statuses/{sha}","languages_url":"https://api.github.com/repos/ijlyttle/devtools/languages","stargazers_url":"https://api.github.com/repos/ijlyttle/devtools/stargazers","contributors_url":"https://api.github.com/repos/ijlyttle/devtools/contributors","subscribers_url":"https://api.github.com/repos/ijlyttle/devtools/subscribers","subscription_url":"https://api.github.com/repos/ijlyttle/devtools/subscription","commits_url":"https://api.github.com/repos/ijlyttle/devtools/commits{/sha}","git_commits_url":"https://api.github.com/repos/ijlyttle/devtools/git/commits{/sha}","comments_url":"https://api.github.com/repos/ijlyttle/devtools/comments{/number}","issue_comment_url":"https://api.github.com/repos/ijlyttle/devtools/issues/comments{/number}","contents_url":"https://api.github.com/repos/ijlyttle/devtools/contents/{+path}","compare_url":"https://api.github.com/repos/ijlyttle/devtools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ijlyttle/devtools/merges","archive_url":"https://api.github.com/repos/ijlyttle/devtools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ijlyttle/devtools/downloads","issues_url":"https://api.github.com/repos/ijlyttle/devtools/issues{/number}","pulls_url":"https://api.github.com/repos/ijlyttle/devtools/pulls{/number}","milestones_url":"https://api.github.com/repos/ijlyttle/devtools/milestones{/number}","notifications_url":"https://api.github.com/repos/ijlyttle/devtools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ijlyttle/devtools/labels{/name}","releases_url":"https://api.github.com/repos/ijlyttle/devtools/releases{/id}","deployments_url":"https://api.github.com/repos/ijlyttle/devtools/deployments","created_at":"2015-08-17T16:15:17Z","updated_at":"2016-04-07T16:46:50Z","pushed_at":"2016-06-06T15:13:44Z","git_url":"git://github.com/ijlyttle/devtools.git","ssh_url":"git@github.com:ijlyttle/devtools.git","clone_url":"https://github.com/ijlyttle/devtools.git","svn_url":"https://github.com/ijlyttle/devtools","homepage":"","size":3838,"stargazers_count":0,"watchers_count":0,"language":"R","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":"hadley:master","ref":"master","sha":"c1a6d4f6bd05bf399e0e0e513ea8dbbe2157541d","user":{"login":"hadley","id":4196,"avatar_url":"https://avatars.githubusercontent.com/u/4196?v=3","gravatar_id":"","url":"https://api.github.com/users/hadley","html_url":"https://github.com/hadley","followers_url":"https://api.github.com/users/hadley/followers","following_url":"https://api.github.com/users/hadley/following{/other_user}","gists_url":"https://api.github.com/users/hadley/gists{/gist_id}","starred_url":"https://api.github.com/users/hadley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hadley/subscriptions","organizations_url":"https://api.github.com/users/hadley/orgs","repos_url":"https://api.github.com/users/hadley/repos","events_url":"https://api.github.com/users/hadley/events{/privacy}","received_events_url":"https://api.github.com/users/hadley/received_events","type":"User","site_admin":false},"repo":{"id":643909,"name":"devtools","full_name":"hadley/devtools","owner":{"login":"hadley","id":4196,"avatar_url":"https://avatars.githubusercontent.com/u/4196?v=3","gravatar_id":"","url":"https://api.github.com/users/hadley","html_url":"https://github.com/hadley","followers_url":"https://api.github.com/users/hadley/followers","following_url":"https://api.github.com/users/hadley/following{/other_user}","gists_url":"https://api.github.com/users/hadley/gists{/gist_id}","starred_url":"https://api.github.com/users/hadley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hadley/subscriptions","organizations_url":"https://api.github.com/users/hadley/orgs","repos_url":"https://api.github.com/users/hadley/repos","events_url":"https://api.github.com/users/hadley/events{/privacy}","received_events_url":"https://api.github.com/users/hadley/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hadley/devtools","description":"Tools to make an R developer's life easier","fork":false,"url":"https://api.github.com/repos/hadley/devtools","forks_url":"https://api.github.com/repos/hadley/devtools/forks","keys_url":"https://api.github.com/repos/hadley/devtools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hadley/devtools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hadley/devtools/teams","hooks_url":"https://api.github.com/repos/hadley/devtools/hooks","issue_events_url":"https://api.github.com/repos/hadley/devtools/issues/events{/number}","events_url":"https://api.github.com/repos/hadley/devtools/events","assignees_url":"https://api.github.com/repos/hadley/devtools/assignees{/user}","branches_url":"https://api.github.com/repos/hadley/devtools/branches{/branch}","tags_url":"https://api.github.com/repos/hadley/devtools/tags","blobs_url":"https://api.github.com/repos/hadley/devtools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hadley/devtools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hadley/devtools/git/refs{/sha}","trees_url":"https://api.github.com/repos/hadley/devtools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hadley/devtools/statuses/{sha}","languages_url":"https://api.github.com/repos/hadley/devtools/languages","stargazers_url":"https://api.github.com/repos/hadley/devtools/stargazers","contributors_url":"https://api.github.com/repos/hadley/devtools/contributors","subscribers_url":"https://api.github.com/repos/hadley/devtools/subscribers","subscription_url":"https://api.github.com/repos/hadley/devtools/subscription","commits_url":"https://api.github.com/repos/hadley/devtools/commits{/sha}","git_commits_url":"https://api.github.com/repos/hadley/devtools/git/commits{/sha}","comments_url":"https://api.github.com/repos/hadley/devtools/comments{/number}","issue_comment_url":"https://api.github.com/repos/hadley/devtools/issues/comments{/number}","contents_url":"https://api.github.com/repos/hadley/devtools/contents/{+path}","compare_url":"https://api.github.com/repos/hadley/devtools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hadley/devtools/merges","archive_url":"https://api.github.com/repos/hadley/devtools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hadley/devtools/downloads","issues_url":"https://api.github.com/repos/hadley/devtools/issues{/number}","pulls_url":"https://api.github.com/repos/hadley/devtools/pulls{/number}","milestones_url":"https://api.github.com/repos/hadley/devtools/milestones{/number}","notifications_url":"https://api.github.com/repos/hadley/devtools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hadley/devtools/labels{/name}","releases_url":"https://api.github.com/repos/hadley/devtools/releases{/id}","deployments_url":"https://api.github.com/repos/hadley/devtools/deployments","created_at":"2010-05-03T04:08:49Z","updated_at":"2016-06-03T16:43:27Z","pushed_at":"2016-06-06T15:13:45Z","git_url":"git://github.com/hadley/devtools.git","ssh_url":"git@github.com:hadley/devtools.git","clone_url":"https://github.com/hadley/devtools.git","svn_url":"https://github.com/hadley/devtools","homepage":"","size":4944,"stargazers_count":1272,"watchers_count":1272,"language":"R","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":415,"mirror_url":null,"open_issues_count":41,"forks":415,"open_issues":41,"watchers":1272,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hadley/devtools/pulls/1142"},"html":{"href":"https://github.com/hadley/devtools/pull/1142"},"issue":{"href":"https://api.github.com/repos/hadley/devtools/issues/1142"},"comments":{"href":"https://api.github.com/repos/hadley/devtools/issues/1142/comments"},"review_comments":{"href":"https://api.github.com/repos/hadley/devtools/pulls/1142/comments"},"review_comment":{"href":"https://api.github.com/repos/hadley/devtools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hadley/devtools/pulls/1142/commits"},"statuses":{"href":"https://api.github.com/repos/hadley/devtools/statuses/f0b9cc9b37f2ff8f294754a34088c104a2f6c0ab"}}}}
{"actor":{"display_login":"ijlyttle"}}