Skip to contents

Fetch issues from a GH repository

Usage

gh_issue_fetch(
  state = "open",
  labels = NULL,
  since = NULL,
  owner = "rosadmin",
  repo = "scheduled_socials",
  issue = NULL,
  verbose = FALSE
)

Arguments

state

Character. Which issues to fetch: "open", "closed", "all"

labels

Character vector. Fetch only issues with these labels. (Optional)

since

Character/Date/datetime. Fetch only issues since this date/time. (Optional)

owner

Character. Owner of the repository

repo

Character. Name of the repository (name of the package)

issue

Numeric. Specific Issue number to fetch.

verbose

Logical. Show progress messages.

Value

List of issues

Examples

i <- gh_issue_fetch()
#> Error in (function (endpoint, ..., per_page = NULL, .per_page = NULL,     .token = NULL, .destfile = NULL, .overwrite = FALSE, .api_url = NULL,     .method = "GET", .limit = NULL, .accept = "application/vnd.github.v3+json",     .send_headers = NULL, .progress = TRUE, .params = list(),     .max_wait = 600, .max_rate = NULL) {    params <- c(list(...), .params)    params <- drop_named_nulls(params)    check_exclusive(per_page, .per_page, .require = FALSE)    per_page <- per_page %||% .per_page    if (is.null(per_page) && !is.null(.limit)) {        per_page <- max(min(.limit, 100), 1)    }    if (!is.null(per_page)) {        params <- c(params, list(per_page = per_page))    }    req <- gh_build_request(endpoint = endpoint, params = params,         token = .token, destfile = .destfile, overwrite = .overwrite,         accept = .accept, send_headers = .send_headers, max_wait = .max_wait,         max_rate = .max_rate, api_url = .api_url, method = .method)    if (req$method == "GET")         check_named_nas(params)    raw <- gh_make_request(req)    res <- gh_process_response(raw, req)    len <- gh_response_length(res)    if (.progress && !is.null(.limit)) {        pages <- min(gh_extract_pages(res), ceiling(.limit/per_page))        cli::cli_progress_bar("Running gh query", total = pages)        cli::cli_progress_update()    }    while (!is.null(.limit) && len < .limit && gh_has_next(res)) {        res2 <- gh_next(res)        len <- len + gh_response_length(res2)        if (.progress)             cli::cli_progress_update()        if (!is.null(names(res2)) && identical(names(res), names(res2))) {            res3 <- mapply(function(x, y, n) {                z <- c(x, y)                atm <- is.atomic(z)                if (atm && n %in% c("total_count", "incomplete_results")) {                  y                }                else if (atm) {                  unique(z)                }                else {                  z                }            }, res, res2, names(res), SIMPLIFY = FALSE)        }        else {            res3 <- c(res, res2)        }        attributes(res3) <- attributes(res2)        res <- res3    }    if (.progress)         cli::cli_progress_done()    if (!is.null(.limit) && len > .limit && !"total_count" %in%         names(res) && length(res) == len) {        res_attr <- attributes(res)        res <- res[seq_len(.limit)]        attributes(res) <- res_attr    }    res})(endpoint = r, state = state, labels = labels, since = since,     issue = issue, sort = "created", direction = "desc", owner = owner,     repo = repo, .limit = Inf): GitHub API error (404): Not Found
#>  URL not found:
#>   <https://api.github.com/repos/rosadmin/scheduled_socials/issues?state=open&sort=created&direction=desc&per_page=100>
#>  Read more at
#>   <https://docs.github.com/rest/issues/issues#list-repository-issues>