R/check-ci.R

output_pkgchk_ci <- function (checks) {

    # Relevant issues: #87, #255

    has_badges <- length (checks$info$badges) > 0L
    check_pass <- has_workflows <- FALSE
    if (length (checks$info$github$workflows) > 0L) {
        wf <- checks$info$github$workflows
        # Exclude 'pkgcheck' workflow to avoid recursive failure:
        i <- grep ("cmd|coverage", wf$name, ignore.case = TRUE)
        has_workflows <- length (i) > 0L
        check_pass <- all (wf$conclusion [i] == "success")
        check_pass <- ifelse (is.na (check_pass), FALSE, check_pass)
    }

    out <- list (
        check_pass = check_pass,
        summary = "",
        print = ""
    )

    if (!out$check_pass) {

        if (!checks$checks$has_url) {
            out$summary <- paste0 (
                "Continuous integration checks ",
                "unavailable (no URL in 'DESCRIPTION')."
            )
        } else if (!has_workflows) {
            out$summary <- " Package has no continuous integration checks."
        } else if (has_workflows && !check_pass) {
            out$summary <- " Package fails continuous integration checks."
            if (!has_badges) {
                out$summary <-
                    gsub ("\\.$", ", and has no badges on README", out$summary)
            }
        }

    } else {

        out$summary <- " Package has continuous integration checks."
        if (!has_badges) {
            out$summary <-
                gsub ("\\.$", ", but no badges on README", out$summary)
            checks$info$badges <- "(There do not appear to be any)"
        } else {
            has_badges <- !is.na (checks$info$badges [1])
        }

        # Sec. num = 3 for standard, but 4 for stats packages:
        sec_num <- 3L + "srr" %in% names (checks$info)
        out$print <- list (
            msg_pre = paste0 ("#### ", sec_num, "a. Continuous Integration Badges"),
            obj = checks$info$badges,
            msg_post = character (0L)
        )

        if (!is.null (checks$info$github$workflows)) {
            out$print$msg_post <- paste0 (
                "**GitHub Workflow Results**",
                "",
                knitr::kable (checks$info$github$workflows)
            )
        }
    }

    return (out)
}

Try the pkgcheck package in your browser

Any scripts or data that you put into this service are public.

pkgcheck documentation built on Oct. 13, 2026, 5:06 p.m.