Generate Game Results #90
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: Generate Game Results | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Runs at 00:00 every day | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
run-r-script: | |
runs-on: ubuntu-latest | |
container: | |
image: rocker/tidyverse:4.1.0 # Using the pre-built R image with tidyverse | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v3 | |
- name: Install additional packages | |
run: | | |
install.packages(c("jsonlite"), repos = "https://cloud.r-project.org") | |
shell: Rscript {0} | |
- name: Run R script | |
run: Rscript scripts/generate-game-results.r | |
- name: Set up Git | |
run: | | |
git config --global --add safe.directory /__w/site/site | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
- name: Commit and push if changes | |
run: | | |
git add . | |
if [[ $(date +\%j) -eq $(( ($(date +\%j) / 3) * 3 )) ]]; then | |
git diff --staged --quiet || (git commit -m "Update word game data" && git push) | |
else | |
git diff --staged --quiet || (git commit -m "Update word game data [skip ci]" && git push) | |
fi |