-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
I am trying to setup a GitHub action to automate some steps using easyPubMed. I am facing some challenges with accessing the GitHub secret containing the environment variable for the PubMed API key.
Using Sys.getenv("API_TOKEN_PUBMED") will provide an empty string ("") if it cannot find it. If batch_pubmed_download() is provided this empty string in the api_key argument, it will get stuck in an infinite loop (Killing the request! Something is not working. Please, try again later), which is harder to debug from GitHub actions since we cannot see this message from a rendered rmarkdown file.
My suggestion is to error if api_key is empty:
if (`api_key` == "") stop("api_key cannot be an empty string.")Reprex:
library(easyPubMed)
ml_query <- "Machine Learning[TI] AND 2016[PD]"
out1 <- batch_pubmed_download(pubmed_query_string = ml_query, batch_size = 500, api_key = "")
#> Killing the request! Something is not working. Please, try again later
#> Killing the request! Something is not working. Please, try again later
#> Killing the request! Something is not working. Please, try again later
[...]
#> Killing the request! Something is not working. Please, try again laterMetadata
Metadata
Assignees
Labels
No labels