mirror of
https://github.com/apache/superset.git
synced 2026-05-22 00:05:15 +00:00
ci(country-map): regenerate GeoJSON outputs on config changes
New workflow `.github/workflows/country-map-build-regen.yml` that: 1. Triggers on PRs touching the build pipeline configs (or manually via workflow_dispatch). 2. Sets up Python 3.11 + Node 22 + PyYAML. 3. Runs `./scripts/build.sh` from a clean checkout. 4. Detects output drift (uncommitted changes in `superset/static/assets/country-maps/` or `src/data/manifest.json`). 5. If drift detected on a PR: leaves a comment telling the contributor to re-run the build locally and commit, then fails CI. This forces "configs and outputs stay in sync" — a contributor can't add a name override / region aggregation / composite without also updating the committed GeoJSON outputs. Tagged contents permissions only — does not auto-PR (which would require deeper repo setup); contributors are expected to regenerate locally and push. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
72
.github/workflows/country-map-build-regen.yml
vendored
Normal file
72
.github/workflows/country-map-build-regen.yml
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
# Re-runs the Country Map plugin's build pipeline whenever its YAML
|
||||
# configs change, then opens a PR with the updated GeoJSON outputs.
|
||||
# Verifies the pipeline stays reproducible and surfaces cartographic
|
||||
# diffs to maintainers as legible GeoJSON, not opaque notebook JSON.
|
||||
|
||||
name: country-map / regenerate outputs
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- 'superset-frontend/plugins/plugin-chart-country-map/scripts/**'
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
regen:
|
||||
name: Regenerate GeoJSON + manifest
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: '22'
|
||||
|
||||
- name: Install build script deps
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install pyyaml
|
||||
|
||||
- name: Run build pipeline
|
||||
run: |
|
||||
cd superset-frontend/plugins/plugin-chart-country-map/scripts
|
||||
./build.sh
|
||||
|
||||
- name: Detect output drift
|
||||
id: drift
|
||||
run: |
|
||||
if [ -n "$(git status --porcelain superset/static/assets/country-maps/ \
|
||||
superset-frontend/plugins/plugin-chart-country-map/src/data/manifest.json)" ]; then
|
||||
echo "drift=true" >> "$GITHUB_OUTPUT"
|
||||
echo "Outputs differ from committed snapshot:"
|
||||
git status --short superset/static/assets/country-maps/
|
||||
else
|
||||
echo "drift=false" >> "$GITHUB_OUTPUT"
|
||||
echo "Outputs match committed snapshot — nothing to do."
|
||||
fi
|
||||
|
||||
- name: Comment on PR if drift
|
||||
if: steps.drift.outputs.drift == 'true' && github.event_name == 'pull_request'
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
run: |
|
||||
gh pr comment "$PR_NUMBER" --repo "${{ github.repository }}" --body \
|
||||
"⚠️ Country Map: this PR changes the build configs but the committed GeoJSON outputs in \`superset/static/assets/country-maps/\` are stale. Re-run \`./scripts/build.sh\` locally and commit the regenerated files."
|
||||
|
||||
- name: Fail if drift on PR
|
||||
if: steps.drift.outputs.drift == 'true' && github.event_name == 'pull_request'
|
||||
run: exit 1
|
||||
Reference in New Issue
Block a user