Skip to content

Refresh pack dashboard #1442

Refresh pack dashboard

Refresh pack dashboard #1442

Workflow file for this run

name: Refresh pack dashboard
on:
schedule:
- cron: '0 * * * *' # every hour at :00 UTC
workflow_dispatch: {} # manual trigger
push:
branches: [main]
paths:
- 'generate.py'
- 'generate_routes.py'
- 'tracked-packs.yaml'
- 'schema/**'
- '.github/workflows/refresh.yml'
# Queue rather than cancel: a refresh may be mid commit-and-push, and two
# concurrent runs race on pushing to main (the loser fails on non-fast-forward).
concurrency:
group: refresh
cancel-in-progress: false
permissions:
contents: write
actions: write
jobs:
refresh:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- run: pip install -r requirements.txt
- run: python generate.py
env:
# DASHBOARD_PAT is a fine-grained PAT with contents:read on the
# nebari-dev pack repos; the default workflow token cannot see
# private packs. Falls back for forks/local checks.
GITHUB_TOKEN: ${{ secrets.DASHBOARD_PAT || secrets.GITHUB_TOKEN }}
- run: python generate_routes.py
env:
GITHUB_TOKEN: ${{ secrets.DASHBOARD_PAT || secrets.GITHUB_TOKEN }}
- name: Commit if changed
id: commit
run: |
git add README.md worker/src/routes.json site/src/generated/search-indexes.json
if git diff --cached --quiet; then
echo "No changes."
echo "changed=false" >> "$GITHUB_OUTPUT"
else
git config user.name "pack-dashboard-bot"
git config user.email "[email protected]"
git commit -m "chore: refresh dashboard ($(date -u +%Y-%m-%dT%H:%M:%SZ))"
git push
echo "changed=true" >> "$GITHUB_OUTPUT"
fi
# A push made with GITHUB_TOKEN does not trigger portal-deploy's push
# event, and workflow_dispatch is the documented exception that does
# create a run, so dispatch it explicitly when the data changed.
# Deliberately the default token here, not DASHBOARD_PAT: the dispatch
# needs this repo's actions:write, which the read-only PAT lacks.
- name: Redeploy portal
if: steps.commit.outputs.changed == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh workflow run portal-deploy.yml --ref main