|
| 1 | +name: Update GNSS-RO Dashboard |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths: |
| 8 | + - 'tools/**' |
| 9 | + - 'docs/**' |
| 10 | + - '.github/workflows/dashboard.yml' |
| 11 | + |
| 12 | + schedule: |
| 13 | + # 06:30 UTC daily — CDAAC typically has yesterday's data by ~05:00 UTC |
| 14 | + - cron: '30 6 * * *' |
| 15 | + |
| 16 | + workflow_dispatch: |
| 17 | + inputs: |
| 18 | + date: |
| 19 | + description: 'Date to fetch (YYYY-MM-DD). Defaults to yesterday.' |
| 20 | + required: false |
| 21 | + default: '' |
| 22 | + |
| 23 | +jobs: |
| 24 | + update-dashboard: |
| 25 | + name: Fetch RO data and rebuild dashboard |
| 26 | + runs-on: ubuntu-latest |
| 27 | + permissions: |
| 28 | + contents: write # needed to push docs/ back to the repo |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: Checkout repository |
| 32 | + uses: actions/checkout@v4 |
| 33 | + with: |
| 34 | + fetch-depth: 0 |
| 35 | + |
| 36 | + - name: Set up Python |
| 37 | + uses: actions/setup-python@v5 |
| 38 | + with: |
| 39 | + python-version: '3.11' |
| 40 | + cache: 'pip' |
| 41 | + |
| 42 | + - name: Install dependencies |
| 43 | + run: pip install -r requirements.txt |
| 44 | + |
| 45 | + - name: Create required directories |
| 46 | + run: mkdir -p tools/data/nc_cache docs |
| 47 | + |
| 48 | + - name: Determine fetch date |
| 49 | + id: date |
| 50 | + run: | |
| 51 | + if [ -n "${{ github.event.inputs.date }}" ]; then |
| 52 | + echo "target=${{ github.event.inputs.date }}" >> $GITHUB_OUTPUT |
| 53 | + else |
| 54 | + echo "target=$(date -u -d 'yesterday' '+%Y-%m-%d')" >> $GITHUB_OUTPUT |
| 55 | + fi |
| 56 | +
|
| 57 | + - name: Fetch daily RO profiles |
| 58 | + working-directory: tools |
| 59 | + run: python3 fetch_daily.py ${{ steps.date.outputs.target }} |
| 60 | + env: |
| 61 | + PYTHONUNBUFFERED: "1" |
| 62 | + |
| 63 | + - name: Clean NetCDF cache |
| 64 | + run: rm -rf tools/data/nc_cache |
| 65 | + |
| 66 | + - name: Rebuild dashboard HTML |
| 67 | + working-directory: tools |
| 68 | + run: python3 make_dashboard_next.py |
| 69 | + |
| 70 | + - name: Check for changes |
| 71 | + id: changes |
| 72 | + run: | |
| 73 | + git diff --quiet docs/ tools/data/ \ |
| 74 | + && echo "changed=false" >> $GITHUB_OUTPUT \ |
| 75 | + || echo "changed=true" >> $GITHUB_OUTPUT |
| 76 | +
|
| 77 | + - name: Commit and push |
| 78 | + if: steps.changes.outputs.changed == 'true' |
| 79 | + run: | |
| 80 | + git config user.name "github-actions[bot]" |
| 81 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 82 | + git add docs/ tools/data/ |
| 83 | + git commit -m "dashboard: auto-update for ${{ steps.date.outputs.target }} [skip ci]" |
| 84 | + git push |
0 commit comments