Created
March 3, 2018 13:28
-
-
Save dpastoor/ccc862a823629447fceb2265e3bed7af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repo_create <- try(gh::gh("POST /user/repos", | |
name = repo_nm, | |
description = paste("Website for workshop", repo_nm)), | |
silent = TRUE) | |
if (inherits(repo_create, "try-error")) { | |
stop("Can't create repository. Does it already exist?") | |
} else if (inherits(repo_create, "gh_response")) { | |
if (identical(attr(repo_create, "response")$status, | |
"201 Created")) | |
message("repo created") | |
} else stop("something went wrong in repository creation.") | |
## 2. import repository | |
owner_id <- repo_create$owner$login | |
res <- gh::gh("PUT /repos/:owner/:repo/import", | |
owner = owner_id, repo = repo_nm, | |
vcs_url = "https://github.com/swcarpentry/workshop-template", | |
vcs = "git", | |
.send_headers = c("Accept" = "application/vnd.github.barred-rock-preview")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"languages": [ | |
"R" | |
], | |
"tags": [ | |
"try", | |
"error" | |
], | |
"references": [ | |
"https://github.com/fmichonneau/shiny-workshop/blob/master/server.R#L77" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment