CovidHub-baseline #20
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-baseline" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "30 20 * * 3" | |
jobs: | |
generate-baseline-forecasts: | |
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 }} | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
install-r: false | |
use-public-rspm: true | |
- name: Install dependencies | |
run: | | |
install.packages(c("readr", "dplyr", "tidyr", "purrr", "checkmate", "cli", "lubridate", "argparser", "remotes", "genlasso")) | |
remotes::install_github("cmu-delphi/epiprocess") | |
remotes::install_github("cmu-delphi/epipredict") | |
shell: Rscript {0} | |
- name: generate baseline | |
run: | | |
REF_DATE=$(Rscript -e "cat(strftime(lubridate::ceiling_date(lubridate::today(), 'week', week_start = 6, change_on_boundary = FALSE)))") | |
Rscript src/get_baseline.R --reference-date "$REF_DATE" | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
message: "Add baseline forecasts" | |
default_author: github_actions | |
push: true | |
new_branch: add-baseline | |
- name: Create pull request | |
id: create_pr | |
run: | | |
gh pr create --base main --head add-baseline --title "Add baseline forecast" --body "This PR is generated automatically." | |
env: | |
GH_TOKEN: ${{ steps.get_workflow_token.outputs.token }} |