Update target data #71
This file contains hidden or 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: Update target data | |
on: | |
workflow_dispatch: | |
inputs: | |
publish: | |
description: 'Publish the target data' | |
type: boolean | |
required: false | |
default: true | |
schedule: | |
- cron: "20 16 * * 3" | |
permissions: | |
contents: write | |
pull-requests: write | |
jobs: | |
update_target_data: | |
if: github.repository_owner == 'cdcepi' | |
runs-on: macOS-latest | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- name: Install dependencies | |
run: | | |
install.packages("RSocrata", repos = c("https://chicago.r-universe.dev", "https://cloud.r-project.org")) | |
install.packages(c("here", "cli", "tidyr", "readr", "dplyr", "lubridate")) | |
shell: Rscript {0} | |
- name: Generate target csv files | |
run: Rscript target-data/get_target_data.R | |
- name: Generate target csv files (with new hubverse flavor!) | |
run: Rscript target-data/get_target_data_hubverse.R | |
- name: Commit changes and create PR 🚀 | |
if: ${{ inputs.publish || github.event_name == 'schedule' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add target-data/ | |
git commit -m "Update target data" || echo nothing to commit | |
git push origin main |