Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

State minimum version for gh and remove conditional code #1088

Merged
merged 4 commits into from
Apr 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 1 addition & 6 deletions R/github-labels.R
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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")
Expand Down
4 changes: 1 addition & 3 deletions R/pr.R
Original file line number Diff line number Diff line change
Expand Up @@ -392,16 +392,14 @@ 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,
.limit = Inf,
.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())
}

Expand Down
4 changes: 3 additions & 1 deletion R/tidyverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down