Github Action failing to install from devtools

Hi,

I have had a github Action setup for quite a while that periodically scraped a website for data for me. Part of the action was installing some dependencies of the script. One of these dependencies is a package that I also maintain and I want to install the devtools version of it.

This has been running fine and automatically for about a year but recently stopped working.

The error code I get in the actions logs is

Rscript -e 'devtools::install_github("jimmyday12/fitzRoy")'
  shell: /bin/bash -e {0}
  env:
    R_LIBS_USER: /Users/runner/work/_temp/Library
    TZ: UTC
    _R_CHECK_SYSTEM_CLOCK_: FALSE
    NOT_CRAN: true
Using bundled GitHub PAT. Please add your own PAT to the env var `GITHUB_PAT`
Error: Error: Failed to install 'unknown package' from GitHub:
  HTTP error 401.
  Bad credentials

You can see the failed run here > updating workflow file · jimmyday12/fitzroy_data@a151a41 · GitHub
And the workflow file here.

A note on the workflow file - normally all dependencies would be installed in one step but I split them up while it was breaking so I could debug.

It seems like it is failing due to not being able to correctly access Github. Has something changed where I need to provide GITHUB_PAT as some kind of environment variable as part of an action?

I've tried installing on various local machines and it works fine so it's fairly unique to the Action.

Any help would be appreciated! I'm not exactly sure if this is a Github Actions issue, a devtools issue or something with my own package so I'm a bit stumped at what to try.

2 Likes

I have worked it out. Adding an environment variable fixes things. This was never in the Action previously so something must have changed somewhere. Hopefully this helps people running into the same issue.

I borrowed this from the r-lib/actions examples.

    env:
      GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
7 Likes

Thanks for sharing! I'm sure you saved me a couple hours to figure this out! I agree there must have been some recent change at Github because the same thing happened to me.

The new message on this thread motivated me to explore the issue.

Using the PAT is only to increase the rate limits. The default rate limit for unauthenticated requests is only 60 per hour, and remotes needs to do a API request for all packages being installed, to verify their versions and see if they need to be updated.

You can do it without the PAT but you may then find you are running into rate limits often.

All r-lib examples have the correct lines.

1 Like

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.