Lab meeting announcement #276
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: "Lab meeting announcement" | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 8,9 * * 1" | |
| jobs: | |
| announce-meeting: | |
| runs-on: ubuntu-latest | |
| env: | |
| RSPM: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" | |
| GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
| SLACK_INCOMING_WEBHOOK_URL: ${{ secrets.EPIFORECASTS_WEBHOOK }} | |
| steps: | |
| - uses: actions/checkout@master | |
| # Fix SSL libraries | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libssl-dev libcurl4-openssl-dev | |
| - uses: r-lib/actions/setup-r@v2 | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| with: | |
| extra-packages: | | |
| pkgload | |
| httr | |
| - uses: r-lib/actions/setup-r-dependencies@v2 | |
| env: | |
| RSPM: "" # Disable RSPM for this step | |
| with: | |
| packages: | | |
| any::curl?source | |
| - name: Announce meeting | |
| env: | |
| GSHEET_ID: ${{ secrets.GSHEET_ID }} | |
| run: | | |
| pkgload::load_all(".") | |
| googlesheets4::gs4_deauth() | |
| this_week_plan <- get_meeting_info(Sys.getenv("GSHEET_ID")) | |
| msg <- create_announcement_msg( | |
| assignee = this_week_plan[["Speaker"]], | |
| random = this_week_plan[["Random"]], | |
| chair = this_week_plan[["Chair"]], | |
| notes = this_week_plan[["Notetaking"]], | |
| topic = this_week_plan[["Topic"]], | |
| time = this_week_plan[["Time"]] | |
| ) | |
| if (!is.null(msg)) { | |
| ## announcement | |
| req <- httr::POST( | |
| url = Sys.getenv("SLACK_INCOMING_WEBHOOK_URL"), | |
| body = list(text = msg, type = "mrkdwn"), | |
| encode = "json" | |
| ) | |
| httr::stop_for_status(req) | |
| ## question of the week | |
| msg <- get_prompt() | |
| req <- httr::POST( | |
| url = Sys.getenv("SLACK_INCOMING_WEBHOOK_URL"), | |
| body = list(text = msg, type = "mrkdwn"), | |
| encode = "json" | |
| ) | |
| httr::stop_for_status(req) | |
| } | |
| shell: Rscript {0} |