Install packages from GitHub

installGitHub(repo, tag, lib = .libPaths()[[1L]], reinstall = TRUE, ...)

Arguments

repo

character. Repository address(es) in the format owner/repo.

tag

character. Release version tag. Specific release must match the tag on GitHub (e.g. "v1.0.0").

lib

character. Destination library directory path. Defaults to the first element of .libPaths().

reinstall

logical(1). Force reinstallation of any existing packages.

...

Passthrough arguments to install().

Value

Invisible list. Metadata containing repo, lib, and whether packages were installed.

Details

This variant doesn't require GITHUB_PAT. If you have a GITHUB_PAT defined, can use install() directly instead. Intended for use inside container images, where a PAT may not be used.

Note

Updated 2021-08-23.

GitHub API

  • All releases JSON: https://api.github.com/repos/:owner/:repo/releases

  • Latest release JSON: https://api.github.com/repos/:owner/:repo/releases/latest

  • Specific release JSON (requires numeric release ID, not tag name): https://api.github.com/repos/:owner/:repo/releases/:release_id

  • Specific tagged release tarball: https://github.com/:owner/:repo/archive/:tag.tar.gz

See also

Examples

testlib <- file.path(tempdir(), "testlib") unlink(testlib, recursive = TRUE) out <- installGitHub( repo = "acidgenomics/r-goalie", tag = "v0.5.2", dependencies = FALSE, lib = testlib, reinstall = TRUE )
#> untar: using cmd = ‘/usr/bin/tar -xf '/var/folders/l1/8y8sjzmn15v49jgrqglghcfr0000gn/T//Rtmp7JbcHQ/file140995f21712b.tar.gz' -C '/var/folders/l1/8y8sjzmn15v49jgrqglghcfr0000gn/T//Rtmp7JbcHQ/untar-sWLklu'’
#> Installing 'goalie' with 'utils::install.packages' in '/private/var/folders/l1/8y8sjzmn15v49jgrqglghcfr0000gn/T/Rtmp7JbcHQ/testlib'.
print(out)
#> $repo #> [1] "acidgenomics/r-goalie" #> #> $lib #> [1] "/private/var/folders/l1/8y8sjzmn15v49jgrqglghcfr0000gn/T/Rtmp7JbcHQ/testlib" #> #> $installed #> [1] TRUE #>
list.dirs(path = testlib, full.names = FALSE, recursive = FALSE)
#> [1] "goalie"
unlink(testlib, recursive = TRUE)