2.2 Compile SV Impacts (as needed) #7
Workflow file for this run
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
### Overwrite FrEDI data with past data | |
name: Compile SV Impacts | |
on: | |
workflow_dispatch: | |
inputs: | |
svSectors: | |
type: choice | |
description: Which SV impact sectors to update | |
options: | |
- Air Quality - Childhood Asthma | |
- Air Quality - Premature Mortality | |
- Labor | |
- Extreme Temperature | |
- Roads | |
- Transportation Impacts from High Tide Flooding | |
- Coastal Properties | |
branch_name: | |
type: string | |
description: Which FrEDI Package branch do you want to use? | |
jobs: | |
compile_data: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
name: Process Data | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Send sector selection | |
run: | | |
echo "${{ github.event.inputs.svSectors }}" | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
- name: Setup R package dependencies | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
cache: true | |
cache-version: 1 | |
packages: | | |
any::tidyverse | |
any::ggpubr | |
any::openxlsx | |
any::devtools | |
- name: Install FrEDI | |
run: | | |
Rscript -e 'devtools::install_github( | |
repo = "https://github.com/USEPA/FrEDI", | |
ref = "${{ github.event.inputs.branch_name }}", | |
subdir = "FrEDI", | |
dependencies = FALSE, | |
upgrade = "never", | |
force = TRUE, | |
type = "source" | |
)' | |
- name: Configure SV data | |
run: | | |
Rscript -e ' | |
source("./scripts/update_svImpactLists.R") | |
fpath1 <- "." | |
fpath1 |> print() | |
sectors1 <- c("${{ github.event.inputs.svSectors }}") | |
list1 <- update_svImpactLists( | |
fpath0 = fpath1, | |
sectors = sectors1, | |
save = T, | |
return = F | |
) | |
' | |
- name: Commit results | |
run: | | |
git config --local core.autocrlf false | |
git config --local user.email "${{ github.actor }}@users.noreply.github.com" | |
git config --local user.name "${{ github.actor }}" | |
git add data/sv/impactsLists/**.rds | |
git pull origin ${{ github.head_ref }} --autostash --rebase -X ours | |
git commit -a -m "Updated SV FrEDI impact lists for ${{ github.event.inputs.svSectors }}" | |
git push |