CovidHub-ensemble #13
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
name: "CovidHub-ensemble" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "00 15 * * 4" | |
jobs: | |
generate-covidhub-ensemble: | |
if: ${{ github.repository_owner == 'CDCgov' }} | |
runs-on: ubuntu-22.04 | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Get Token | |
id: get_workflow_token | |
uses: peter-murray/workflow-application-token-action@v4 | |
with: | |
application_id: ${{ vars.GH_APP_ID }} | |
application_private_key: ${{ secrets.GH_APP_KEY }} | |
- uses: actions/checkout@v4 | |
- 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 -y libcurl4-openssl-dev | |
- name: Install dependencies | |
run: | | |
install.packages(c("hubEnsembles", "dplyr", "lubridate", "purrr", "yaml", "argparser", "remotes")) | |
remotes::install_github("hubverse-org/hubData") | |
shell: Rscript {0} | |
- name: generate ensemble | |
run: | | |
REF_DATE=$(Rscript -e "cat(strftime(lubridate::ceiling_date(lubridate::today(), 'week', week_start = 6, change_on_boundary = FALSE)))") | |
Rscript src/get_ensemble.R --reference-date "$REF_DATE" --base_hub_path "." | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: "Add CovidHub ensemble forecasts" | |
default_author: github_actions | |
push: true | |
new_branch: add-ensemble | |
- name: Create pull request | |
id: create_pr | |
run: | | |
gh pr create --base main --head add-ensemble --title "Add ensemble forecast" --body "This PR is generated automatically to add a quantile median ensemble forecast." | |
env: | |
GH_TOKEN: ${{ steps.get_workflow_token.outputs.token }} |