Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pak::pkg_deps() only allows for a single package definition #29

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions setup-macOS-dependencies/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ runs:
# Need for url remotes. See https://github.com/r-lib/actions/issues/562#issuecomment-1129088041
install.packages("digest", repos = "http://cran.us.r-project.org")
}
split_pkg_str <- function(txt) {
strsplit(txt, "[[:space:],]+")[[1]]
}
pkg_deps <- NULL
if (file.exists("DESCRIPTION")) {
# Get packages like `{grDevices}` which will not be returned by `{pak}`
Expand All @@ -51,22 +48,20 @@ runs:
# Local deps
pkg_deps <- c(pkg_deps, pkg_names, pak::local_dev_deps(dependencies = TRUE)[["package"]])
}
get_pkg_deps <- function(txt) {
pkgs <- strsplit(txt, "[[:space:],]+")[[1]]
unlist(lapply(pkgs, function(x) pak::pkg_deps(x, dependencies = TRUE)[["package"]]))
}
# Needs deps; Must find all dependencies of of the needs pkgs
if (nzchar("${{ inputs.needs }}") && file.exists("DESCRIPTION")) {
needs_pkgs <- as.list(read.dcf("DESCRIPTION")[1,])[["Config/Needs/${{ inputs.needs }}"]]
if (!is.null(needs_pkgs)) {
pkg_deps <- c(
pkg_deps,
pak::pkg_deps(split_pkg_str(needs_pkgs), dependencies = TRUE)[["package"]]
)
pkg_deps <- c(pkg_deps, get_pkg_deps(needs_pkgs))
}
}
# Extra package deps
if (nzchar("${{ inputs.extra-packages }}")) {
pkg_deps <- c(
pkg_deps,
pak::pkg_deps(split_pkg_str("${{ inputs.extra-packages }}"), dependencies = TRUE)[["package"]]
)
pkg_deps <- c(pkg_deps, get_pkg_deps("${{ inputs.extra-packages }}"))
}
pkg_deps <- unique(pkg_deps)
cat("Packages found:\n"); print(pkg_deps)
Expand Down