Create live dashboard #34
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: Create live dashboard | |
permissions: | |
contents: write | |
on: | |
workflow_dispatch: | |
inputs: | |
# To save bandwidth, input names will be somewhat non-specific | |
# i.e. "p" is lighter than "poll" as it saves 3 characters | |
# Further note -- the GHA API call is so big that 3 chars wont matter | |
p: | |
description: 'Result from RTM poll' | |
required: true | |
type: string | |
jobs: | |
ingest-data: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Quarto | |
uses: quarto-dev/quarto-actions/setup@v2 | |
- name: Set up R | |
uses: r-lib/actions/setup-r@v2 | |
with: | |
use-public-rspm: true | |
- name: Set up R packages | |
uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
packages: | |
any::data.table | |
any::ggplot2 | |
any::knitr | |
any::plotly | |
any::quarto | |
- name: Munge data | |
run: Rscript -e 'source("work/parsers.R"); parse_payload(${{ inputs.p }}, "data/parsed.csv")' | |
- name: Build dashboard | |
run: | | |
cd dashboard | |
quarto render index.qmd | |
- name: Push log and dashboard | |
run: | | |
git config --global user.name 'gha update bot' | |
git config --global user.email 'mhpob@users.noreply.github.com' | |
git add --all | |
git commit --allow-empty -m "[auto] Build Dashboard $(TZ=America/New_York date +'%Y-%m-%d %H:%M')" | |
git push | |
# | |
# # TBD: transfer data from ingest-data to build-dash | |
# build-dash: | |
# needs: ingest-data | |
# runs-on: ubuntu-latest | |
# env: | |
# GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
# RENV_PATHS_ROOT: ~/.local/share/renv | |
# steps: | |
# | |
# - name: Check out repository | |
# uses: actions/checkout@v4 | |
# | |
# - name: Set up Quarto | |
# uses: quarto-dev/quarto-actions/setup@v2 | |
# | |
# - name: Set up R | |
# uses: r-lib/actions/setup-r@v2 | |
# with: | |
# use-public-rspm: true | |
# | |
# - name: Set up R packages | |
# uses: r-lib/actions/setup-r-dependencies@v2 | |
# with: | |
# packages: | |
# any::dplyr | |
# any::knitr | |
# any::quarto | |
# | |
# ### add misc. steps | |
# | |
# - name: Was the dashboard updated? | |
# id: dashboard-updated | |
# run: | | |
# if [[ $(git status --porcelain -- index.html index_files/) ]]; then | |
# echo "has_update=true" >> "$GITHUB_OUTPUT" | |
# fi | |
# | |
# - name: Push Built Dashboard | |
# if: steps.dashboard-updated.outputs.has_update == 'true' | |
# run: | | |
# git config --global user.name 'gha update bot' | |
# git config --global user.email 'mhpob@users.noreply.github.com' | |
# git add --all | |
# git commit --allow-empty -m "[auto] Build Dashboard $(TZ=America/New_York date +'%Y-%m-%d %H:%M')" | |
# git push | |
# | |
# - name: Render and Publish | |
# if: steps.dashboard-updated.outputs.has_update == 'true' | |
# uses: quarto-dev/quarto-actions/publish@v2 | |
# with: | |
# target: gh-pages | |
# render: false | |
# path: index.qmd | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |