Skip to content

Execute R script

Execute R script #25

name: Execute R script
on:
schedule:
- cron: '0 0 * * 0' # This runs the action every Sunday at midnight UTC
workflow_dispatch: # This allows the workflow to be triggered manually
jobs:
compute-producers-share:
runs-on: ubuntu-latest
steps:
- name: Set Up R
uses: r-lib/actions/setup-r@v2
- name: Install packages
uses: r-lib/actions/setup-r-dependencies@v2
with:
packages: |
any::httr
any::readr
- name: Check out repository
uses: actions/checkout@v3
- name: Compute producer's share
run: Rscript -e 'source("main.R")'
- name: Commit results
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add .
git commit -m 'Data updated' || echo "No changes to commit"
git push origin || echo "No changes to commit"