Skip to contents

Install GitHub Packages

Usage

installGithubPackages(
  lib,
  repos,
  dependencies = TRUE,
  upgrade = "never",
  auth_token = Sys.getenv("GITHUB_PAT")
)

Arguments

lib

path to R library where packages should be installed

repos

vector of relative paths to GitHub repositories containing R packages (e.g. "kwb-r/kwb.utils")

dependencies

passed to remotes::install_github(). TRUE is shorthand for "Depends", "Imports", "LinkingTo" and "Suggests" NA is shorthand for "Depends", "Imports" and "LinkingTo" and is the default. FALSE is shorthand for no dependencies (i.e. just check this package, not its dependencies), (default: TRUE)

upgrade

passed to install_github, (default: "never")

auth_token

GitHub Personal Access token, required with scope "private" if access to non-public R packages is required (default: Sys.getenv("GITHUB_PAT"))

Value

installs multiple GitHub R packages into one R library

Examples

if (FALSE) {
remotes::install_github("kwb-r/pkgmeta") 
pkgs <- pkgmeta::get_github_packages()
paths_list <- list(
  r_version = kwb.packages::getRVersionMajorMinor(),
  lib_linux = "/usr/lib/R/site-library",
  lib_win = "<win_root_dir>/kwbran/<r_version>"
)

paths <- kwb.utils::resolve(paths_list, win_root_dir = tempdir())

pkgs <- pkgmeta::get_github_packages()

installGithubPackages(lib = paths$lib_win, pkgs$full_name)
installGithubPackages(lib = paths$lib_linux, pkgs$full_name)
}