Skip to content

Round 5 Submission from MODUS_Covid-Episim #238

Round 5 Submission from MODUS_Covid-Episim

Round 5 Submission from MODUS_Covid-Episim #238

name: Link to submission preview
on:
pull_request_target:
branches: main
paths:
- 'data-processed/**'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
submission_preview:
runs-on: ubuntu-20.04
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: r-lib/actions/setup-r@v2
with:
install-r: false
use-public-rspm: true
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev
# This workflow cannot work with renv since we never check out the repo.
- name: Install R dependencies
run: |
install.packages('gh')
shell: Rscript {0}
- name: Post comment linking to preview shiny app
env:
PR_NUMBER: ${{ github.event.number }}
run: |
source("https://gist.githubusercontent.com/Bisaloo/db50c50922dc5d8d71791fe210e625be/raw/9eff642b8f481f34de2671e940327645498f972f/link_preview_app.R")
try({
links <- link_preview(
gh_repo = Sys.getenv("GITHUB_REPOSITORY"),
pr_number = Sys.getenv("PR_NUMBER"),
data_folder = "data-processed",
app_location = "https://forecasthub.shinyapps.io/covid19-scenario-hub-europe/"
)
message("Preview link:\n ", paste(links, collapse = "\n "))
if (!is.null(links)) {
gh::gh(
"/repos/{gh_repo}/issues/{pr_number}/comments",
.method = "POST",
gh_repo = Sys.getenv("GITHUB_REPOSITORY"),
pr_number = Sys.getenv("PR_NUMBER"),
accept = "application/vnd.github.v3+json",
body = paste(c("Preview of submitted forecast:", links), collapse = "\n\n")
)
}
}, silent = TRUE)
shell: Rscript {0}