Deploy and automate your code to the cloud
Set up a cron job to run your R scripts at specified times.
Enabled with a simple yaml configuration file.
Save the following as main.yml in .github/workflows of your Github repository:
: Action
name:
on:
schedule- cron: '30 22 * * 1-5'
:
jobs:
render-on: windows-latest
runs:
steps- uses: actions/checkout@v2
- name: Set up R
: r-lib/actions/setup-r@v1
uses- name: Install dependencies
: |
runinstall.packages(c("magrittr", "purrr"), type = "win.binary")
: Rscript {0}
shell- name: Script
: Rscript nameofscript.R
run- name: Commit files
: |
run--local user.name github-actions
git config --local user.email "actions@github.com"
git config /*
git add docs-am "commit on $(date)"
git commit
git push origin main:
env: ${{secrets.GITHUB_TOKEN}}
REPO_KEY: github-actions username
To generate R Markdown documents (or for that matter render a Distill website), you will want to add the following step after ‘Set up R’:
- name: Set up Pandoc
: r-lib/actions/setup-pandoc@v1 uses
The Github Actions with R reference:
https://orchid00.github.io/actions_sandbox/
For attribution, please cite this work as
shikokuchuo (2021, May 4). shikokuchuo{net}: Github Actions with R. Retrieved from https://shikokuchuo.net/posts/05-ghactions/
BibTeX citation
@misc{shikokuchuo2021github, author = {shikokuchuo, }, title = {shikokuchuo{net}: Github Actions with R}, url = {https://shikokuchuo.net/posts/05-ghactions/}, year = {2021} }