diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..feb9205 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.Rproj.user +.Rhistory +.RData +.Ruserdata +r-verdepcheck-action.Rproj diff --git a/README.md b/README.md index 7419729..672de44 100644 --- a/README.md +++ b/README.md @@ -18,70 +18,29 @@ When executed for A, script would read A's `DESCRIPTION` file, determine version Please see [`verdepcheck`](https://github.com/insightsengineering/verdepcheck) package documentation for details. ## Action type + Composite ## Author -Insights Engineering - -## Inputs -* `github-token`: - - _Description_: Token with permissions to clone repositories with dependencies. - - _Required_: `false` - - _Default_: `""` - -* `repository-path`: - - _Description_: Directory where the checked package has been cloned. - - _Required_: `false` - - _Default_: `repository` - -* `extra-deps`: - - _Description_: Extra dependencies specified similarly as in the `DESCRIPTION` file, i.e. `" ( )"` where both `` and `` are optional. Multiple entries are possible separated by `";"`. - - _Required_: `false` - - _Default_: `""` -* `check-args`: +[Insights Engineering](https://github.com/insightsengineering/) - _Description_: Optional value of `args` argument to `rcmdcheck::rcmdcheck` in form of a string with space as delimeter, e.g. `"--no-examples --no-tests"`. - - _Required_: `false` - - _Default_: `""` - -* `build-args`: - - _Description_: Optional value of `build_args` argument to `rcmdcheck::rcmdcheck` in form of a string with space as delimeter, e.g. `"--force --keep-empty-dirs"`. - - _Required_: `false` - - _Default_: `""` - -* `strategy`: - - _Description_: Strategy for dependency test, should be one of: min, release, max. - - _Required_: `true` - -* `additional-env-vars`: - - _Description_: Additional environment variables. - - _Required_: `false` - - _Default_: `""` +## Inputs +| Input | Description | Required | Default | +| -------------- | --------------------------------------------------------------- | ------- | ---- | +| `github-token` | Token with permissions to clone repositories with dependencies. | _no_ | `""` | +| `repository-path` | Directory where the checked package has been cloned. | _no_ | `"repository"` | +| `extra-deps` | Extra dependencies specified similarly as in the `DESCRIPTION` file, i.e. `" ( )"` where both `` and `` are optional. Multiple entries are possible separated by `";"`. | _no_ | `""` | +| `check-args` | Optional value of `args` argument to `rcmdcheck::rcmdcheck` in form of a string with space as delimeter, e.g. `"--no-examples --no-tests"`. | `false` | `""` | +| `build-args` | Optional value of `build_args` argument to `rcmdcheck::rcmdcheck` in form of a string with space as delimeter, e.g. `"--force --keep-empty-dirs"`. | `false` | `""` | +| `strategy` | Strategy for dependency test, should be one of: min, release, max. | _yes_ | | +| `additional-env-vars` | Additional environment variables. | _no_ | `""` | +| `additional-repos` | Optional value that add R repositories for a given strategy. Multiple entries are possible separated by `";"`. | _no_ | `""` | ## Outputs -None +_None_ ## Usage diff --git a/action.yaml b/action.yaml index e31d3ff..20638fc 100644 --- a/action.yaml +++ b/action.yaml @@ -37,6 +37,13 @@ inputs: XYZ=456 required: false default: "" + additional-repos: + description: | + Optional value that add R repositories for a given strategy (multiple repos per strategy can be defined by separating with a comma). + Example usage: + additional-repos: https://repo1.example.com,https://repo2.example.com + required: false + default: "" branding: icon: 'refresh-ccw' @@ -57,7 +64,7 @@ runs: echo ".libPaths(\" \", include.site = FALSE)" > .Rprofile export R_LIBS_SITE=" " export R_LIBS_USER=" " - Rscript ${GITHUB_ACTION_PATH}/script.R '${{ inputs.repository-path }}' '${{ inputs.extra-deps }}' '${{ inputs.build-args }}' '${{ inputs.check-args }}' '${{ inputs.strategy }}' + Rscript ${GITHUB_ACTION_PATH}/script.R '${{ inputs.repository-path }}' '${{ inputs.extra-deps }}' '${{ inputs.build-args }}' '${{ inputs.check-args }}' '${{ inputs.strategy }}' '${{ inputs.additional-repos }}' shell: bash env: GITHUB_PAT: "${{ inputs.github-token }}" diff --git a/script.R b/script.R index 80ecc93..daede25 100644 --- a/script.R +++ b/script.R @@ -8,9 +8,9 @@ catnl_param <- function(x = "") { if (length(x) == 0) cat(var_string, "(empty)\n") else cat(var_string, x, "\n") } -catnl("Install required packages") +catnl("\n── \033[1mInstall required packages\033[22m ────────────") -install.packages(c("remotes", "cli"), quiet = TRUE, verbose = FALSE) +install.packages(c("remotes", "cli", "rlang"), quiet = TRUE, verbose = FALSE) remotes::install_github("insightsengineering/verdepcheck", quiet = TRUE, verbose = FALSE) remotes::install_github("r-lib/rcmdcheck#196", quiet = TRUE, verbose = FALSE) # TODO: remove when merged / linked issue fixed @@ -20,12 +20,16 @@ extra_deps <- args[2] build_args <- strsplit(args[3], " ")[[1]] check_args <- strsplit(args[4], " ")[[1]] strategy <- args[5] +additional_repositories <- strsplit(args[6], ";")[[1]] cli::cli_h1("Cat script parameters") catnl_param(path) catnl_param(extra_deps) catnl_param(build_args) catnl_param(check_args) +catnl_param(additional_repositories) + +rlang::local_options(repos = c(options("repos"), additional_repositories)) cli::cli_h1("Execute verdepcheck...") fun <- switch(