Github Actions with R

[This article was first published on shikokuchuo{net}, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

                                                            sha256
1 6f5b37d9b73dcd70f3c8b68eabbe00c4a709f2a3e694d964121af145105f1655

Github Actions with R

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:

name: Raction
on:
  schedule:
    - cron: '30 22 * * 1-5'
jobs:
  render:
    runs-on: windows-latest
    steps:
      - uses: actions/checkout@v2
      - name: Set up R
        uses: r-lib/actions/setup-r@v1
      - name: Install dependencies
        run: |
          install.packages(c("magrittr", "purrr"), type = "win.binary")
        shell: Rscript {0}
      - name: Script
        run: Rscript nameofscript.R
      - name: Commit files
        run: |
          git config --local user.name github-actions
          git config --local user.email "[email protected]"
          git add output/*
          git commit -am "commit on $(date)"
          git push origin main
        env:
          REPO_KEY: ${{secrets.GITHUB_TOKEN}}
          username: github-actions

Reference

The Github Actions with R reference:
https://orchid00.github.io/actions_sandbox/

To leave a comment for the author, please follow the link and comment on their blog: shikokuchuo{net}.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)