Issues with Non-Interactive Authentication in GitHub Actions

Hello! I am trying to create a GitHub Actions workflow to automatically pull detection data from a receiver on a schedule. I am running into issues with authentication, as the motus R package prompts interactively for login credentials via readline(), which always returns an empty string in a non-interactive environment like GitHub Actions.

I have my credentials stored as GitHub secrets and am passing them as environment variables at runtime. I have also tried setting Motus$userLogin and Motus$userPassword directly before calling tagme(), but the package still prompts interactively and fails with the error:

Error: session variable 'userLogin' is undefined

Here is a simplified version of what I am trying:

Motus$userLogin = Sys.getenv('MOTUS_USER')
Motus$userPassword = Sys.getenv('MOTUS_PASS')

recv <- tagme(
  'CTT-XXXXXXXX',
  new = TRUE,
  update = TRUE,
  dir = 'data/'
)

I am using motus version 6.x on Ubuntu (via GitHub Actions). Has anyone successfully authenticated non-interactively in an automated or CI environment? Any guidance would be greatly appreciated

Hi @jdun4d!

I’m the developer of the motus package. And yes, we use something like this method for authenticating motus for testing the package on GitHub Actions, and I’ve used it in another project to authenticate for a workflow.

The difference for me in the package is that I’ve embedded the authentication for testing in motus itself (perks of being a developer).

However, perhaps the method I used in Motus tracking of urban migration stopovers - Setup would help?

In your case this would be:

motus:::sessionVariable(name = “userLogin”, val = Sys.getenv(“MOTUS_USER”))
motus:::sessionVariable(name = “userPassword”, val = Sys.getenv(“MOTUS_PASS”))

I know this is using unexported functions (sessionVariable) which is not great, and it is on the road map to make this more elegant.

I hope this helps!

1 Like

Thank you for response! That is exactly what I needed :grin:

1 Like