CovidHub-baseline #19
This file contains hidden or 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-latest | |
| env: | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Generate Installation Token | |
| id: get_token | |
| uses: actions/create-github-app-token@v1 | |
| with: | |
| app-id: ${{ vars.GH_APP_ID }} | |
| 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: true | |
| use-public-rspm: true | |
| - name: Install dependencies | |
| run: | | |
| install.packages(c("fs", "readr", "dplyr", "tidyr", "cli", "lubridate", "nanoparquet", "argparser", "remotes", "genlasso")) | |
| remotes::install_github("cmu-delphi/epiprocess") | |
| remotes::install_github("cmu-delphi/epipredict") | |
| remotes::install_github("cdcgov/forecasttools") | |
| 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" --base-hub-path "." | |
| - 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_token.outputs.token }} |