R/get_gh_ratelimit.R

Defines functions get_gh_ratelimit

Documented in get_gh_ratelimit

#' Get GitHub rate limit
#'
#' @param github_token token passed to \link[gh]{gh} (default:
#' Sys.getenv("GITHUB_PAT")
#' @return overview of rate limit
#' @export
#' @importFrom gh gh
#' @importFrom  dplyr bind_rows
#' @examples
#' get_gh_ratelimit()
get_gh_ratelimit <- function(github_token = Sys.getenv("GITHUB_PAT")) {

  res <- gh::gh(endpoint = "https://api.github.com/rate_limit",
         .token = github_token)

  dplyr::bind_rows(res$resources,.id = "id")
}
KWB-R/pkgmeta documentation built on March 27, 2024, 4:28 p.m.