Skip to content

insightsengineering/setup-r-dependencies

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Setup R Dependencies Action

Description

A wrapper on r-lib/actions/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).

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 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

    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