Execute R script #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |