Min Workflow for Automated Data #4112
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: '00 10,22 * * *' | |
push: | |
branches: main | |
name: Min Workflow for Automated Data | |
jobs: | |
render: | |
name: Min Workflow for Automated Data | |
runs-on: macOS-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
- uses: r-lib/actions/setup-pandoc@v1 | |
- name: Query dependencies | |
run: Rscript -e 'install.packages("remotes");saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2);writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")' | |
- name: Cache R packages | |
if: runner.os != 'Windows' | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.R_LIBS_USER }} | |
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} | |
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- | |
- name: Install dependencies | |
run: Rscript -e 'remotes::install_deps()' | |
- name: Render R Markdown | |
run: Rscript -e 'rmarkdown::render(input = "index.Rmd", output_dir="docs")' | |
- name: Commit results | |
run: | | |
git add -A | |
git commit -m 'New Data Detected - data updated!' || echo "No changes to commit" | |
git push origin || echo "No changes to commit" | |