library(httr)
pkgload::load_all()
library(testthat)

setwd("tests/testthat")
pkg_files <- list.files("../../R", full.names = TRUE)
test_files <- list.files(".", pattern = ".R", full.names = TRUE)

out <- paste(
  capture.output(
    covr::file_coverage(pkg_files, test_files),
    type = "message"
  ),
  collapse = "\\n"
)
httr::PATCH(
  url = "https://api.github.com/projects/columns/cards/69293545",
  add_headers(
    authorization = glue::glue("token {Sys.getenv('GITHUB_PAT')}"),
    accept = "application/vnd.github.inertia-preview+json"
  ),
  body = glue::glue('{{"note": "{out}"}}')
)
