RSV Hub Ensemble Model #10
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: "RSV Hub Ensemble Model" | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "30 13 * * 4" | |
| permissions: | |
| contents: write | |
| jobs: | |
| generate-ensemble-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@v2 | |
| with: | |
| app-id: ${{ vars.CDCGOV_HUB_BOT_APP_ID }} | |
| private-key: ${{ secrets.CDCGOV_HUB_BOT_APP_KEY }} | |
| - name: "Checkout Code" | |
| uses: actions/checkout@v5 | |
| - name: "Setup R" | |
| uses: r-lib/actions/setup-r@v2 | |
| with: | |
| install-r: true | |
| use-public-rspm: true | |
| - name: "Install System Dependencies" | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libcurl4-openssl-dev | |
| - name: "Set Up R Dependencies" | |
| uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| pak-version: "devel" | |
| packages: | | |
| github::cdcgov/hubhelpr | |
| - name: "Generate Ensemble" | |
| run: | | |
| REF_DATE=$(Rscript -e "cat(strftime(lubridate::ceiling_date(lubridate::today(), 'week', week_start = 6, change_on_boundary = FALSE)))") | |
| Rscript -e "hubhelpr::generate_hub_ensemble('.', '$REF_DATE', 'rsv', c('hosp', 'prop ed visits'))" | |
| - name: "Set Date" | |
| run: echo "DATE=$(date +%Y-%m-%d)" >> $GITHUB_ENV | |
| - name: "Commit Changes" | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git checkout -b add-rsv-ensemble-${{ env.DATE }} | |
| git add . | |
| git commit -m "Add RSV ensemble forecasts" | |
| git push origin add-rsv-ensemble-${{ env.DATE }} | |
| - name: "Create Pull Request" | |
| id: create_pr | |
| run: | | |
| gh pr create --base main --head add-rsv-ensemble-${{ env.DATE }} --title "Add RSV ensemble forecast" --body "This PR is generated automatically to add a quantile median ensemble forecast." | |
| env: | |
| GH_TOKEN: ${{ steps.get_token.outputs.token }} |