{httr} is superseded in favor of {httr2}. We don't have much usage, so it should be "easy" to refactor in favor of the newer/better-supported package:
|
github_comment <- function(text, info = NULL, token = settings$comment_token) { |
|
if (!requireNamespace("httr", quietly = TRUE)) { |
|
stop("Package 'httr' is required to post comments with github_comment().") |
|
} |
|
if (!requireNamespace("jsonlite", quietly = TRUE)) { |
|
stop("Package 'jsonlite' is required to post comments with github_comment().") |
|
} |
|
|
|
if (is.null(info)) { |
|
info <- ci_build_info() |
|
} |
|
|
|
if (!is.null(info$pull) && info$pull != "false") { |
|
api_subdir <- file.path("issues", info$pull) |
|
} else if (!is.null(info$commit)) { |
|
api_subdir <- file.path("commits", info$commit) |
|
} else { |
|
stop("Expected a pull or a commit, but received ci_build_info() = ", format(info)) |
|
} |
|
response <- httr::POST( |
|
"https://api.github.com", |
|
path = file.path("repos", info$user, info$repo, api_subdir, "comments"), |
|
body = list(body = jsonlite::unbox(text)), |
|
query = list(access_token = token), |
|
encode = "json" |
|
) |
|
|
|
if (httr::status_code(response) >= 300L) { |
|
message(httr::http_condition(response, "error", task = httr::content(response, as = "text"))) |
|
} |
|
} |
{httr} is superseded in favor of {httr2}. We don't have much usage, so it should be "easy" to refactor in favor of the newer/better-supported package:
lintr/R/comments.R
Lines 85 to 115 in 203be65