2.1 Compile SV Data (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: 2.1 Compile SV Data (as needed) | |
on: | |
workflow_dispatch: | |
inputs: | |
run_sv: | |
type: choice | |
description: Update SV proportions | |
required: true | |
options: | |
- no | |
- yes | |
run_formats: | |
type: choice | |
description: Update SV formatting table | |
required: true | |
options: | |
- no | |
- yes | |
run_pop: | |
type: choice | |
description: Update SV population projections | |
required: true | |
options: | |
- no | |
- yes | |
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 input status | |
run: | | |
echo "${{ inputs.run_sv }} ${{ inputs.run_formats }} ${{ inputs.run_pop }}" | |
- 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 | |
if: | | |
${{ inputs.run_sv }} == 'true' || | |
${{ inputs.run_pop }} == 'true' || | |
${{ inputs.run_formats }} == 'true' | |
run: | | |
Rscript -e ' | |
source("./scripts/update_svDataObjects.R") | |
fpath1 <- getwd() | |
sv0 <- ifelse("${{ inputs.run_sv }}" == "true",TRUE,FALSE) | |
pop0 <- ifelse("${{ inputs.run_pop }}" == "true",TRUE, FALSE) | |
format0 <- ifelse("${{ inputs.run_formats }}" == "true",TRUE,FALSE) | |
list1 <- update_svDataObjects( | |
fpath0 = fpath1, | |
sv = sv0, | |
pop = pop0, | |
format = format0, | |
save = TRUE, | |
return = TRUE | |
) | |
' | |
- name: Commit results | |
if: | | |
${{ inputs.run_sv }} == 'true' || | |
${{ inputs.run_pop }} == 'true' || | |
${{ inputs.run_formats }} == 'true' | |
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/**.rda | |
git pull origin ${{ github.head_ref }} --autostash --rebase -X ours | |
git commit -a -m "Updated SV FrEDI data objects" | |
git push |