line / conflr

Post R Markdown documents to Confluence
https://line.github.io/conflr/
GNU General Public License v3.0
130 stars 28 forks source link

Automating using Task Scheduler #141

Closed pateld1 closed 2 years ago

pateld1 commented 2 years ago

I got two files here, a .Rmd file that creates an html document, and a .R file that sets the Renviron variables and then calls confl_create_post_from_Rmd(...). I created a task in Task Scheduler to open the .R file using Rscript.exe and run the code to create the post using the .Rmd file. However when running the task, it appears to fail after reading in my Renviron file and at the point where the post is to be created. I did set interactive to FALSE and update to TRUE. If I run the R file on RStudio, the code works and publishes fine to Confluence. But when using Task Scheduler it seems to break. Is there any way to fix this? How can I use this package with Task Scheduler? (Note that I am not using a batch file and I simply put the Rmd filename in the arguments on Task Scheduler).

pateld1 commented 2 years ago

I actually figured this one out by myself, and the issue wasn't coming from conflr 😄

For anyone who sees this in the future, basically the .Renviron file requires a RSTUDIO_PANDOC variable that is a path name to the pandoc folder in RStudio. Since the job uses R (not RStudio), it doesn't recognize pandoc which is required for the markdown document to be made.