data-refresh #1607
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: | |
workflow_dispatch: | |
schedule: | |
- cron: '15 23 * * *' | |
# Run at every 15th minute past every 24th hour ~ 1 refresh a day. | |
name: data-refresh | |
jobs: | |
render: | |
name: data-refresh | |
runs-on: macos-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: Install Dependencies | |
run: Rscript -e 'install.packages(c("tidyverse", "tm", "ggwordcloud", "rvest", "lubridate", "rmarkdown"))' | |
- name: Rebuild data | |
run: Rscript -e 'source("data-raw/01-setup-mass-mail.R")' | |
- name: Commit data updates | |
run: | | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
git add data/* data-raw/* || echo "No new data to add" | |
git commit -m 'Re-build data' || echo "No data changes to commit" | |
git push origin || echo "No changes to commit" | |
- name: Render README | |
run: Rscript -e 'rmarkdown::render("README.Rmd")' | |
- name: Commit README graph updates | |
run: | | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
git add README.md README_files/* || echo "No figures to add" | |
git commit -m 'Re-build README.Rmd and Graphs' || echo "No updated figures to commit" | |
git push origin || echo "No changes to commit" |