updater #37595
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: updater | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '*/5 * * * *' | |
push: | |
paths: | |
- 'updater.R' | |
jobs: | |
run-updater: | |
runs-on: macOS-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
NYT_S: ${{ secrets.NYT_S }} | |
TOKEN_KEY: ${{ secrets.TOKEN_KEY }} | |
SHEET_ID: = ${{ secrets.SHEET_ID }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: r-lib/actions/setup-r@v2 | |
- name: Restore R package cache | |
id: cache-r-packages | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ runner.os }}-${{ hashFiles('install-packages.R') }}-1 | |
- name: Install packages | |
if: steps.cache-r-packages.outputs.cache-hit != 'true' | |
run: R -e 'source("install-packages.R", echo = TRUE)' | |
- name: Download Parse and Update Leaderboard Data | |
run: Rscript updater.R | |
# Add new files in folder, commit along with other modified files, push | |
- name: Commit and push if it changed | |
run: |- | |
git config user.name "updater" | |
git config user.email "actions@users.noreply.github.com" | |
git add -A | |
timestamp=$(date -u) | |
git commit -m "Latest leaderboard data: ${timestamp}" || exit 0 | |
git push |