Skip to content

Update-data

Update-data #258

Workflow file for this run

name: Update-data
on:
workflow_dispatch:
schedule:
- cron: "0 23 * * 2"
- cron: "0 23 * * 5"
jobs:
ncsl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main # Checkout branch into the runner
- uses: r-lib/actions/setup-r@v2-branch # Set up R runtime
with:
r-version: '4.3.3'
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Setup renv # Set up R env to install packages
run: |
install.packages('remotes')
install.packages("renv")
system("sudo apt-get install libcurl4-openssl-dev")
shell: Rscript {0}
- uses: actions/cache@v2 # Cache packages so won't be compiled everytime job is run
with:
path: ~/.local/share/renv
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Install dependencies # Install the dependencies eg. Dplyr, tidyverse etc
run: renv::restore()
shell: Rscript {0}
- name: Generate data # Run the script
run: source("code/ncsl.R")
shell: Rscript {0}
- name: Commit files # Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git pull origin main
git add -A
git diff-index --quiet HEAD || (git commit -m "update published ncsl data ${{ steps.date.outputs.date }}" && git push)
vrl:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main # Checkout branch into the runner
- uses: r-lib/actions/setup-r@v2-branch # Set up R runtime
with:
r-version: '4.3.3'
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Setup renv # Set up R env to install packages
run: |
install.packages('remotes')
install.packages("renv")
system("sudo apt-get install libcurl4-openssl-dev")
shell: Rscript {0}
- uses: actions/cache@v2 # Cache packages so won't be compiled everytime job is run
with:
path: ~/.local/share/renv
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Install dependencies # Install the dependencies eg. Dplyr, tidyverse etc
run: renv::restore()
shell: Rscript {0}
- name: Generate data # Run the script
run: source("code/vrl.R")
shell: Rscript {0}
- name: Commit files # Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git pull origin main
git add -A
git diff-index --quiet HEAD || (git commit -m "update published vrl data ${{ steps.date.outputs.date }}" && git push)
update-docs:
runs-on: ubuntu-latest
needs: [ncsl,vrl]
steps:
- uses: actions/checkout@main # Checkout branch into the runner
- uses: r-lib/actions/setup-r@v2-branch # Set up R runtime
with:
r-version: '4.3.3'
- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
- name: Setup renv # Set up R env to install packages
run: |
install.packages('remotes')
install.packages("renv")
system("sudo apt-get install libcurl4-openssl-dev")
shell: Rscript {0}
- uses: actions/cache@v2 # Cache packages so won't be compiled everytime job is run
with:
path: ~/.local/share/renv
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Install dependencies # Install the dependencies eg. Dplyr, tidyverse etc
run: renv::restore()
shell: Rscript {0}
- name: Generate data # Run the script
run: source("code/update_documentation.R")
shell: Rscript {0}
- name: Commit files # Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git pull origin main
git add -A
git diff-index --quiet HEAD || (git commit -m "update readme ${{ steps.date.outputs.date }}" && git push)