daily-fantasypros #498
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
on: | |
schedule: | |
- cron: 3 */12 * * * | |
workflow_dispatch: | |
name: daily-fantasypros | |
jobs: | |
daily-fantasypros: | |
runs-on: ubuntu-20.04 | |
env: | |
RSPM: https://packagemanager.rstudio.com/cran/__linux__/focal/latest | |
GITHUB_PAT: ${{ secrets.GH_PAT }} | |
steps: | |
- name: Checkout private db repo | |
uses: actions/checkout@v2 | |
with: | |
path: private | |
repository: dynastyprocess/db | |
token: ${{ secrets.GH_PAT }} | |
- name: Checkout public data repo | |
uses: actions/checkout@v2 | |
with: | |
path: public | |
- name: Install R | |
uses: r-lib/actions/setup-r@v2 | |
id: install-r | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
cache-version: 1 | |
working-directory: ./private | |
extra-packages: | | |
ffverse/ffscrapr | |
ffverse/ffpros | |
- name: Scrape FantasyPros | |
working-directory: ./private | |
run: | | |
source("R/fantasypros/scrape_weeklyecr.R", chdir = TRUE) | |
shell: Rscript {0} | |
- name: Save public data | |
working-directory: ./public | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Actions" | |
git add files | |
git commit -m "Daily FP scrape `date`" || echo "No changes to commit" | |
git push origin master | |
- name: Upload log results | |
if: failure() | |
uses: actions/upload-artifact@main | |
with: | |
name: scrape-logs | |
path: ./private/fp-scrape-log.txt |