I have two repositories that I update daily by simply opening the project in RStudio and knitting the RMD file, then pushing the results to the repo.
I would love to automate this with GitHub actions but I find the documentation highly confusing.
Is there an "Explain it like I'm 5" on doing this particular thing?
So I made a bash file located at ./bash/data_refresh.sh
and a github actions file data_refresh.yaml
Bash file:
#!/bin/bash
echo "Rendering the page..."
Rscript -e "rmarkdown::render(input = 'README.Rmd')"
if [[ "$(git status --porcelain)" != "" ]]; then
git config --global user.name 'my_user_name'
git config --global user.email 'my_email_address'
git add *
git commit -m "Auto update Report"
git push
fi
Here is my yaml
:
# This is a basic workflow to help you get started with Actions
name: Package Data Refresh
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
schedule:
- cron: '0 12 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
name: refresh the dashboard
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: checkout_repo
uses: actions/checkout@v2
with:
ref: 'master'
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Render Rmarkdown
run: bash ./bash/data_refresh.sh
I am getting the following error and not sure how to rectify it.
Run bash ./bash/data_refresh.sh
bash ./bash/data_refresh.sh
shell: /usr/bin/bash -e {0}
Rendering the page...
Error in loadNamespace(x) : there is no package called ‘rmarkdown’
Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted