Set an env variable on a specific OS R version combination in a GitHub Action to check an R package

I'm using a slightly modified version of r-libs check-standard.yaml to check a package. The modification is to check on R 3.5 in additional to the other OS/R combinations.

I would like to skip checking cross refs in Rd files only on R 3.5 (or an earlier version of R) as one of the packages the we now link to isn't available on such an old OS but our package should install and work fine on this older version of R. (Note we don't have the packages we crossref in Suggests as there seems little point in adding a soft dependency for a cross ref.

Our workflow is here if you're interested/it matters.

Can I add an environmental variable to a single OS/R version so it doesn't affect checks on the other OS/R combinations?

The matrix we're using is:

      matrix:
        config:
          - {os: macOS-latest,   r: 'release'}
          - {os: windows-latest, r: 'release'}
          - {os: ubuntu-latest,   r: 'devel', http-user-agent: 'release'}
          - {os: ubuntu-latest,   r: 'release'}
          - {os: ubuntu-latest,   r: 'oldrel-1'}
          - {os: ubuntu-latest,   r: '3.6'}
          - {os: ubuntu-latest,   r: '3.5'}

I note that http-user-agent is set for one of the runners; is it possible to add an env node here and set a specific env var here too?

The env var I wish to set is _R_CHECK_RD_XREFS_: FALSE

You can also have a conditional step. Something like this:

- name: Set env vars before R 3.5
   if: ${{ matrix.config.r == '3.5' || matrix.config.r == '3.4' }}
   run: |
     echo "_R_CHECK_RD_XREFS_=FALSE" >> $GITHUB_ENV
2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.