Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/insightsengineering/setup-r-dependencies

GitHub Action to install R package dependencies
https://github.com/insightsengineering/setup-r-dependencies

actions github-actions r

Last synced: 10 days ago
JSON representation

GitHub Action to install R package dependencies

Awesome Lists containing this project

README

        

# Setup R Dependencies Action

## Description

A wrapper on [`r-lib/actions/setup-r-dependencies`](https://github.com/r-lib/actions/tree/v2-branch/setup-r-dependencies) with additional features as below:

- Use dependencies from identical feature branch (if exists). This allows to co-develop packages and test them together.
- Use development version of dependencies if specified in the `DESCRIPTION` file. This allows to test packages with dependencies that are not yet released.

This logic requires additional input of package references to check against. Please see the `lookup-refs` parameter description for more details. Currently, only GitHub references are supported.

The implementation relies on the `pkgdepends` package and it is temporarily changing the `DESCRIPTION` file by adding new `Config/Needs/` fields. Then `r-lib/actions/setup-r-dependencies` is called with the `needs` parameter.

For private repositories, run the action with `GITHUB_PAT` environment variable set to GitHub token. This is handled by `pak` (via `gitcreds` - see the [documentation](https://gitcreds.r-lib.org/reference/gitcreds_get.html)).

## Action type
Composite

## Author
Insights Engineering

## Inputs
* `repository-path`:

_Description_: Directory where the R package is located relative to the calling GitHub workflow workspace.

_Required_: `false`

_Default_: `"."`

* `lookup-refs`:

_Description_: List of [package references](https://r-lib.github.io/pkgdepends/reference/pkg_refs.html) to be used for the feature branch. Multiple entries in new lines or separated by commas. Only GitHub references are supported.

_Required_: `false`

_Default_: `""`

* `dependencies`:

_Description_: Passed to `r-lib/actions/setup-r-dependencies`.

_Required_: `false`

_Default_: `"all"`

* `extra-packages`:

_Description_: Passed to `r-lib/actions/setup-r-dependencies`.

_Required_: `false`

_Default_: `""`

* `install-quarto`:

_Description_: Passed to `r-lib/actions/setup-r-dependencies`.

_Required_: `false`

_Default_: `auto`

* `cache-version`:

_Description_: Passed to `r-lib/actions/setup-r-dependencies`.

_Required_: `false`

_Default_: `1`

* `needs`:

_Description_: Passed to `r-lib/actions/setup-r-dependencies`. The value will be amended by `DepsBranch` and `DepsDev` values.

_Required_: `false`

_Default_: `""`

* `skip-desc-branch`:

_Description_: Skip branch lookup for dependencies specified in the `DESCRIPTION` file.

_Required_: `false`

_Default_: `false`

* `skip-desc-dev`:

_Description_: Skip development version lookup for dependencies specified in the `DESCRIPTION` file.

_Required_: `false`

_Default_: `false`

* `skip-install`:

_Description_: Skip installation of dependencies.

_Required_: `false`

_Default_: `false`

* `max-iter`:

_Description_: Maximum number of iterations to resolve dependencies.

_Required_: `false`

_Default_: `10`

* `repository-list`:

_Description_: Comma-separated list of pkgcache-compatible repository names from which the dependencies will be downloaded. Optionally, list elements can be named in the form of `name=repo_name`.

_Required_: `false`

_Default_: `"PPM=PPM@latest"`

* `restore-description`:

_Description_: Whether the DESCRIPTION file (modified by this action) should be restored to its original contents?

_Required_: `false`

_Default_: `true`

## Outputs

None

## Usage

```yaml
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup R
uses: r-lib/actions/setup-r@v2

- name: Setup R dependencies
uses: insightsengineering/setup-r-dependencies@v1
with:
github-token: ${{ secrets.REPO_GITHUB_TOKEN }}
lookup-refs: |
test/package1
test/package2
test/package3

- name: Check R package
uses: r-lib/actions/check-r-package@v2
```