From 9d12ef1a84c50e1de8f09fa1a4650dca4b0a8005 Mon Sep 17 00:00:00 2001 From: lakikowolfe Date: Wed, 6 Mar 2024 12:59:09 -0800 Subject: [PATCH] add branch name to renviron --- .github/workflows/shinyapps_deploy.yml | 1 + R/global.R | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/shinyapps_deploy.yml b/.github/workflows/shinyapps_deploy.yml index ea67768..3a0a71d 100644 --- a/.github/workflows/shinyapps_deploy.yml +++ b/.github/workflows/shinyapps_deploy.yml @@ -64,6 +64,7 @@ jobs: echo 'DFA_CLIENT_SECRET="${{ secrets.OAUTH_CLIENT_SECRET }}"' >> .Renviron echo 'DFA_DCC_CONFIG="https://raw.githubusercontent.com/Sage-Bionetworks/data_flow_config/dev/tenants.json"' >> .Renviron echo 'GITHUB_PAT="${{ secrets.GITHUB_TOKEN }}"' >> .Renviron + echo 'DFA_REF="${{ github.ref }}"' >> .Renviron # deploy app using rsconnect - name: Authorize and deploy app diff --git a/R/global.R b/R/global.R index 6bdc09c..e93d2e4 100644 --- a/R/global.R +++ b/R/global.R @@ -1,3 +1,15 @@ +## SET GLOBAL VARS + +# READ IN BRANCH NAME +ref <- Sys.getenv("DFA_REF") + +# SET FAVICON URL +FAVICON_URL <- file.path( + "https://raw.githubusercontent.com/Sage-Bionetworks/data_flow", + ref, # FIXME: Automate branch via env variable + "inst/app/www/favicon.ico" +) + # READ IN TENANTS.JSON tenants_config_path <- Sys.getenv("DFA_DCC_CONFIG") if (is.null(tenants_config_path) || nchar(tenants_config_path) == 0) stop("missing DFA_DCC_CONFIG environmental variable") @@ -64,9 +76,3 @@ api <- httr::oauth_endpoint( # The 'openid' scope is required by the protocol for retrieving user information. scope <- "openid view download modify" - -FAVICON_URL <- file.path( - "https://raw.githubusercontent.com/Sage-Bionetworks/data_flow", - "dev", # FIXME: Automate branch via env variable - "inst/app/www/favicon.ico" -) \ No newline at end of file