Skip to content

Commit

Permalink
Merge pull request #59 from tanho63/newrelease-error
Browse files Browse the repository at this point in the history
new release errors reported verbosely
  • Loading branch information
cboettig authored Mar 3, 2022
2 parents d4e3a51 + 7b11303 commit 37abeca
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
9 changes: 6 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: piggyback
Version: 0.1.1.9001
Version: 0.1.1.9002
Title: Managing Larger Data on a GitHub Repository
Description: Because larger (> 50 MB) data files cannot easily be committed to git,
a different approach is required to manage data associated with an analysis in a
Expand All @@ -23,7 +23,10 @@ Authors@R: c(person("Carl", "Boettiger",
comment = c(ORCID = "0000-0002-4716-6134")),
person("Kevin", 'Kuo',
role = c("ctb"),
comment = c(ORCID = "0000-0001-7803-7901")))
comment = c(ORCID = "0000-0001-7803-7901")),
person("Tan", "Ho",
role = c("ctb"),
comment = c(ORCID = "0000-0001-8388-5155")))
URL: https://github.com/ropensci/piggyback
BugReports: https://github.com/ropensci/piggyback/issues
License: GPL-3
Expand All @@ -50,6 +53,6 @@ Suggests:
usethis,
magrittr
VignetteBuilder: knitr
RoxygenNote: 7.1.1
RoxygenNote: 7.1.2
Roxygen: list(markdown = TRUE)
Language: en-US
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* `pb_upload()` now handles the `dir` argument to control relative path directories.
* update intro vignette to remove mention of path name handling and instead provide examples of how path names are handled.
* update intro vignette instructions for git authentication
* `pb_new_release()` now reports HTTP errors when attempting to create a new release and returns the contents of the error if it fails.

# piggyback 0.1.1

Expand Down
12 changes: 9 additions & 3 deletions R/pb_new_release.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#' @param tag tag to create for this release
#' @param commit Specifies the commit-ish value that
#' determines where the Git tag is created from.
#' Can be any branch or commit SHA. Unused if the
#' Can be any branch or full commit SHA (not the short hash). Unused if the
#' git tag already exists. Default: the repository's
#' default branch (usually `master`).
#' @param name The name of the release. Defaults to tag.
Expand Down Expand Up @@ -44,7 +44,6 @@ pb_new_release <- function(repo = guess_repo(),
}
}


r <- strsplit(repo, "/")[[1]]

payload <- compact(list(
Expand All @@ -67,7 +66,14 @@ pb_new_release <- function(repo = guess_repo(),
body = jsonlite::toJSON(payload, auto_unbox = TRUE)
)

if(getOption("verbose")) httr::warn_for_status(resp)
if(httr::http_error(resp)) {
warning(
paste("Failed to create release: HTTP error",
httr::status_code(resp),
"\nSee returned error messages for more details."),
call. = FALSE)
return(invisible(httr::content(resp)))
}

## Release info changed, so break cache
memoise::forget(memoised_pb_info)
Expand Down
2 changes: 1 addition & 1 deletion man/pb_new_release.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 37abeca

Please sign in to comment.