|
34 | 34 | uv pip install policyengine-uk pandas numpy h5py tables |
35 | 35 |
|
36 | 36 | - name: Generate dashboard data |
| 37 | + id: generate |
| 38 | + continue-on-error: true |
37 | 39 | env: |
38 | 40 | HUGGING_FACE_TOKEN: ${{ secrets.HUGGING_FACE_TOKEN }} |
39 | 41 | PYTHONPATH: ${{ github.workspace }}/src |
|
42 | 44 | source .venv/bin/activate |
43 | 45 | python -c "from scottish_budget_data import generate_all_data; generate_all_data()" |
44 | 46 |
|
| 47 | + - name: Validate existing data files |
| 48 | + if: steps.generate.outcome == 'failure' |
| 49 | + run: | |
| 50 | + echo "Data generation failed (likely due to resource constraints)." |
| 51 | + echo "Validating that sample data files exist..." |
| 52 | +
|
| 53 | + required_files=( |
| 54 | + "public/data/budgetary_impact.csv" |
| 55 | + "public/data/constituency.csv" |
| 56 | + "public/data/distributional_impact.csv" |
| 57 | + "public/data/metrics.csv" |
| 58 | + "public/data/winners_losers.csv" |
| 59 | + ) |
| 60 | +
|
| 61 | + all_exist=true |
| 62 | + for file in "${required_files[@]}"; do |
| 63 | + if [ -f "$file" ]; then |
| 64 | + echo "✓ Found: $file" |
| 65 | + else |
| 66 | + echo "✗ Missing: $file" |
| 67 | + all_exist=false |
| 68 | + fi |
| 69 | + done |
| 70 | +
|
| 71 | + if [ "$all_exist" = false ]; then |
| 72 | + echo "Some required data files are missing!" |
| 73 | + echo "Please run the data generation locally:" |
| 74 | + echo " PYTHONPATH=src python -c \"from scottish_budget_data import generate_all_data; generate_all_data()\"" |
| 75 | + exit 1 |
| 76 | + fi |
| 77 | +
|
| 78 | + echo "" |
| 79 | + echo "All required data files exist. Dashboard will use existing sample data." |
| 80 | + echo "To regenerate with real PolicyEngine data, run locally:" |
| 81 | + echo " PYTHONPATH=src python -c \"from scottish_budget_data import generate_all_data; generate_all_data()\"" |
| 82 | +
|
45 | 83 | - name: Check for changes |
46 | 84 | id: check_changes |
| 85 | + if: steps.generate.outcome == 'success' |
47 | 86 | run: | |
48 | 87 | if git diff --quiet public/data/; then |
49 | 88 | echo "has_changes=false" >> $GITHUB_OUTPUT |
|
52 | 91 | fi |
53 | 92 |
|
54 | 93 | - name: Commit and push changes |
55 | | - if: steps.check_changes.outputs.has_changes == 'true' |
| 94 | + if: steps.generate.outcome == 'success' && steps.check_changes.outputs.has_changes == 'true' |
56 | 95 | run: | |
57 | 96 | git config --local user.email "github-actions[bot]@users.noreply.github.com" |
58 | 97 | git config --local user.name "github-actions[bot]" |
|
0 commit comments