diff --git a/DESCRIPTION b/DESCRIPTION index 080221fee..819644c2a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -30,7 +30,7 @@ Imports: curl (>= 2.7), desc, fs (>= 1.3.0), - gh, + gh (>= 1.1.0), git2r (>= 0.23), glue (>= 1.3.0), purrr, diff --git a/NEWS.md b/NEWS.md index bf768dd9a..d9a16bdec 100644 --- a/NEWS.md +++ b/NEWS.md @@ -172,6 +172,10 @@ put a new folder created by `use_course()` or `create_from_github()` (@malcolmbarrett, #1015). +## Dependency changes + +gh minimum version is stated to be v.1.1.0, due to changed behaviour around requests that return nothing. + # usethis 1.5.1 This is a patch release with various small features and bug fixes. diff --git a/R/github-labels.R b/R/github-labels.R index c28463d12..d9eef174b 100644 --- a/R/github-labels.R +++ b/R/github-labels.R @@ -70,7 +70,7 @@ use_github_labels <- function(repo_spec = github_repo_spec(), check_github_token(auth_token) gh <- function(endpoint, ...) { - out <- gh::gh( + gh::gh( endpoint, ..., owner = spec_owner(repo_spec), @@ -81,11 +81,6 @@ use_github_labels <- function(repo_spec = github_repo_spec(), "Accept" = "application/vnd.github.symmetra-preview+json" ) ) - if (identical(out[[1]], "")) { - list() - } else { - out - } } cur_labels <- gh("GET /repos/:owner/:repo/labels") diff --git a/R/pr.R b/R/pr.R index 4cc2734dd..dfae559b5 100644 --- a/R/pr.R +++ b/R/pr.R @@ -392,7 +392,6 @@ pr_find <- function(owner, repo, pr_owner = owner, pr_branch = git_branch_name()) { - # Look at all PRs prs <- gh::gh("GET /repos/:owner/:repo/pulls", owner = owner, repo = repo, @@ -400,8 +399,7 @@ pr_find <- function(owner, .token = check_github_token(allow_empty = TRUE) ) - # prs has length zero if gh >= v1.1.0 and is "" for earlier versions - if (length(prs) < 1 || identical(prs[[1]], "")) { + if (length(prs) < 1) { return(character()) } diff --git a/R/tidyverse.R b/R/tidyverse.R index 410edd981..27680be6a 100644 --- a/R/tidyverse.R +++ b/R/tidyverse.R @@ -366,7 +366,9 @@ releases <- function(repo_spec = github_repo_spec()) { owner = spec_owner(repo_spec), repo = spec_repo(repo_spec) ) - if (identical(res[[1]], "")) return(NULL) + if (length(res) < 1) { + return(NULL) + } pluck_chr(res, "tag_name") }