RSV Hub Baseline 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 Baseline Model" | |
| 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@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: "Set Up R Dependencies" | |
| uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| pak-version: "devel" | |
| packages: | | |
| github::cdcgov/hubhelpr | |
| - name: "Generate Baseline" | |
| 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_baseline('.', '$REF_DATE', 'rsv')" | |
| - 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-baseline-${{ env.DATE }} | |
| git add . | |
| git commit -m "Add RSV baseline forecasts" | |
| git push origin add-rsv-baseline-${{ env.DATE }} | |
| - name: "Create Pull Request" | |
| id: create_pr | |
| run: | | |
| gh pr create --base main --head add-rsv-baseline-${{ env.DATE }} --title "Add RSV baseline forecast" --body "This PR is generated automatically." | |
| env: | |
| GH_TOKEN: ${{ steps.get_token.outputs.token }} |