Skip to content

.github/workflows/l_r_splits.yaml #283

.github/workflows/l_r_splits.yaml

.github/workflows/l_r_splits.yaml #283

Workflow file for this run

# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
schedule:
# https://crontab.guru/ - every day at 7am
- cron: '0 11 * * *'
jobs:
run-r-script:
runs-on: ubuntu-latest # use Ubuntu
env:
# The GitHub token will be available
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
# imports an action from another repository,
# that enables the machine
# to access the code inside our repository
- uses: actions/checkout@v3
# imports an action from another repository,
# that installs R on the machine
- uses: r-lib/actions/setup-r@v2
with:
# uses the RStudio Package Manager
use-public-rspm: true
# imports an action from another repository,
# that deals with the dependencies
- uses: r-lib/actions/setup-r-dependencies@v2
with:
# here we have to add all the packages we used in the script!
packages: |
any::gh
any::dplyr
any::tidyr
any::readr
any::knitr
any::baseballr
any::tidytable
any::tidyverse
- name: Execute Script
# executes the RScript stored in the file
# 01-monitoring-quarto-repos/script.R
run: |
Rscript "splits_data_23.R"
# save the results in the repository
# using git in the command line
- name: Commit results
run: |
git config --local user.email "actions@github.com"
git config --local user.name "GitHub Actions"
git add .
git commit -m "Results from R script" || echo "No changes to commit"
git push origin || echo "No changes to commit"