`usethis` Github Actions failing with error "there is no package called ‘devtools’"

I'm having trouble setting up github actions for my R package. I used usethis to create two workflows (devtools 2.3.2, usethis 1.6.3), in particular:

usethis::use_github_action_check_standard()
usethis::use_github_action("test-coverage")

Both actions fail on Github, during the "Querying dependencies" step. It fails on all OS's with a similar error. On 'Ubuntu release' the error is:

Run install.packages('remotes')
  install.packages('remotes')
  saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
  writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
  shell: /usr/local/bin/Rscript {0}
  env:
    R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
    RSPM: https://packagemanager.rstudio.com/cran/__linux__/focal/latest
    R_LIBS_USER: /home/runner/work/_temp/Library
    TZ: UTC
    _R_CHECK_SYSTEM_CLOCK_: FALSE
    NOT_CRAN: true
Error: Error in library(devtools) : there is no package called ‘devtools’
Execution halted
Error: Process completed with exit code 1.

I have tried to find information on this error, but couldn't find anything.
I have not changed anything in the workflow files created by usethis. I tried to change install.packages('remotes') to install.packages('devtools') in the worflow file, but that didn't seem to have any effect.

I don't know enough about GH actions to find the problem.

It is because you have library(devtools) in your project's .Rprofile (https://github.com/Teebusch/noah/blob/master/.Rprofile)

R automatically sources the .Rprofile and devtools is not installed on the GitHub Actions workers.

You should remove this file from version control.

3 Likes

That was it! Thank you so much! I don't think I would ever have found it - I was looking in all the wrong places. :grimacing:

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.