2026/05 Sector File Update (#1512) #12
This file contains hidden or 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: π Build V-LARA GeoJSON | |
| on: | |
| push: | |
| paths: | |
| - ".data/TopSky Shared/Areas/AARA/**/*.txt" | |
| - ".data/TopSky Shared/Areas/Danger/**/*.txt" | |
| - ".data/TopSky Shared/Areas/Other/**/*.txt" | |
| - ".data/TopSky Shared/Areas/Restricted/**/*.txt" | |
| - ".data/TopSky Shared/Areas/Surveillance/**/*.txt" | |
| - ".data/TopSky Shared/Areas/TRA/**/*.txt" | |
| - ".data/TopSky Shared/Areas/Training/**/*.txt" | |
| - ".github/workflows/build-vlara-geojson.yml" | |
| - "workflows/V-LARA/topskyareas_to_vlara.py" | |
| - "workflows/V-LARA/validate_geojson.py" | |
| - "workflows/V-LARA/summarise_geojson.py" | |
| pull_request: | |
| paths: | |
| - ".data/TopSky Shared/Areas/AARA/**/*.txt" | |
| - ".data/TopSky Shared/Areas/Danger/**/*.txt" | |
| - ".data/TopSky Shared/Areas/Other/**/*.txt" | |
| - ".data/TopSky Shared/Areas/Restricted/**/*.txt" | |
| - ".data/TopSky Shared/Areas/Surveillance/**/*.txt" | |
| - ".data/TopSky Shared/Areas/TRA/**/*.txt" | |
| - ".data/TopSky Shared/Areas/Training/**/*.txt" | |
| - ".github/workflows/build-vlara-geojson.yml" | |
| - "workflows/V-LARA/topskyareas_to_vlara.py" | |
| - "workflows/V-LARA/validate_geojson.py" | |
| - "workflows/V-LARA/summarise_geojson.py" | |
| workflow_dispatch: {} | |
| concurrency: | |
| group: geojson-build-${{ github.ref }} | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| env: | |
| GEOJSON_OUT: .data/V-LARA/egxx.geojson | |
| SCRIPT_PATH: "workflows/V-LARA/topskyareas_to_vlara.py" | |
| INPUT_DIRS: | | |
| .data/TopSky Shared/Areas/AARA | |
| .data/TopSky Shared/Areas/Danger | |
| .data/TopSky Shared/Areas/Other | |
| .data/TopSky Shared/Areas/Restricted | |
| .data/TopSky Shared/Areas/Surveillance | |
| .data/TopSky Shared/Areas/TRA | |
| .data/TopSky Shared/Areas/Training | |
| jobs: | |
| build-vlara-GeoJSON: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| changed: ${{ steps.changed.outputs.changed }} | |
| touched: ${{ steps.changed.outputs.touched }} | |
| steps: | |
| - name: π§° Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: true | |
| - name: π Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| - name: Install dependencies | |
| shell: bash | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r workflows/V-LARA/requirements.txt | |
| - name: Run tests | |
| shell: bash | |
| run: | | |
| python -m pytest workflows/V-LARA/tests/ | |
| - name: π Workspace sanity check | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| echo "Workspace: $GITHUB_WORKSPACE" | |
| ls -la | |
| if [ ! -f "$SCRIPT_PATH" ]; then | |
| echo "β Script not found at: $SCRIPT_PATH" >&2 | |
| exit 1 | |
| fi | |
| echo "β Found script: $SCRIPT_PATH" | |
| - name: π§ͺ Pre-flight (input dirs) | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| while IFS= read -r d; do | |
| [ -z "$d" ] && continue | |
| if [ ! -d "$d" ]; then | |
| echo "β οΈ Missing directory: $d" >&2 | |
| else | |
| echo "β Found: $d" | |
| count=$(find "$d" -type f -name '*.txt' | wc -l || echo 0) | |
| echo " ββ $count .txt file(s)" | |
| fi | |
| done <<< "$INPUT_DIRS" | |
| - name: ποΈ Build GeoJSON | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| args=() | |
| while IFS= read -r d; do | |
| [ -z "$d" ] && continue | |
| args+=( --input-dir "$d" ) | |
| done <<< "$INPUT_DIRS" | |
| python "$SCRIPT_PATH" "${args[@]}" --output "$GEOJSON_OUT" --debug | |
| - name: π Check output exists | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [ -f "$GEOJSON_OUT" ]; then | |
| ls -lh "$GEOJSON_OUT" | |
| else | |
| echo "β Missing output: $GEOJSON_OUT" | |
| exit 1 | |
| fi | |
| - name: β Validate output | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| python "workflows/V-LARA/validate_geojson.py" | |
| - name: π Summary | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| python "workflows/V-LARA/summarise_geojson.py" | tee -a "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo '```json' >> "$GITHUB_STEP_SUMMARY" | |
| head -n 50 "$GEOJSON_OUT" >> "$GITHUB_STEP_SUMMARY" || true | |
| echo '```' >> "$GITHUB_STEP_SUMMARY" | |
| - name: π¦ Upload artifact (PRs only) | |
| if: github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: airspace-geojson | |
| path: ${{ env.GEOJSON_OUT }} | |
| if-no-files-found: error | |
| - name: π Detect change (push only) | |
| if: github.event_name == 'push' | |
| id: changed | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| git add -N "$GEOJSON_OUT" || true | |
| if git diff --quiet -- "$GEOJSON_OUT"; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| echo "No changes detected." | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| echo "Changes detected." | |
| fi | |
| - name: π Was GeoJSON touched in this push? (push only) | |
| if: github.event_name == 'push' | |
| id: touched | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| BEFORE="${{ github.event.before }}" | |
| AFTER="${{ github.sha }}" | |
| if git diff --name-only "$BEFORE" "$AFTER" | grep -Fx -- "$GEOJSON_OUT" >/dev/null 2>&1; then | |
| echo "touched=true" >> "$GITHUB_OUTPUT" | |
| echo "GeoJSON was touched in this push." | |
| else | |
| echo "touched=false" >> "$GITHUB_OUTPUT" | |
| echo "GeoJSON not touched in this push." | |
| fi | |
| - name: β¬οΈ Commit & push (safe, rebase+retry) | |
| if: github.event_name == 'push' && steps.changed.outputs.changed == 'true' | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add "$GEOJSON_OUT" | |
| git commit -m "chore(geojson): rebuild combined V-LARA GeoJSON" || exit 0 | |
| BRANCH="${GITHUB_REF_NAME}" | |
| for attempt in 1 2 3; do | |
| echo "Attempt $attempt: rebase & pushβ¦" | |
| git pull --rebase origin "$BRANCH" || true | |
| if git push origin "HEAD:$BRANCH"; then | |
| echo "β Push succeeded." | |
| exit 0 | |
| fi | |
| echo "β οΈ Push failed. Retrying in 3sβ¦" | |
| sleep 3 | |
| done | |
| echo "β Push failed after retries." | |
| exit 1 | |
| - name: π§Ύ Last commit (debug) | |
| if: always() | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| git --no-pager log -1 --stat || true | |
| submit-vlara-pr: | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| needs: build-vlara-GeoJSON | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| env: | |
| GH_TOKEN: ${{ secrets.LARA_DEPLOY_KEY }} | |
| UPSTREAM: ottotuhkunen/virtual-lara-airspace-data | |
| FORK: VATSIM-UK/virtual-lara-airspace-data | |
| SOURCE_PATH: .data/V-LARA/egxx.geojson | |
| DEST_PATH: data/egxx.geojson | |
| BRANCH: auto/update-egxx-geojson | |
| steps: | |
| - name: π§° Checkout uk-controller-pack | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: π Verify GeoJSON exists | |
| run: | | |
| set -euo pipefail | |
| if [ -f "$SOURCE_PATH" ]; then | |
| ls -lh "$SOURCE_PATH" | |
| else | |
| echo "β Missing output: $SOURCE_PATH" >&2 | |
| exit 1 | |
| fi | |
| - name: π± Clone VATSIM-UK/virtual-lara-airspace-data fork | |
| run: | | |
| set -euo pipefail | |
| gh repo clone "$FORK" fork -- --depth=1 | |
| cd fork | |
| if git remote get-url upstream >/dev/null 2>&1; then | |
| git remote set-url upstream "https://github.com/${UPSTREAM}.git" | |
| else | |
| git remote add upstream "https://github.com/${UPSTREAM}.git" | |
| fi | |
| git fetch upstream --depth=1 | |
| git checkout -B "$BRANCH" "upstream/main" | |
| git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${FORK}.git" | |
| mkdir -p "$(dirname "$DEST_PATH")" | |
| cp "../$SOURCE_PATH" "$DEST_PATH" | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add "$DEST_PATH" | |
| if git diff --cached --quiet; then | |
| echo "No changes to commit."; exit 0 | |
| fi | |
| git commit -m "Update EGXX GeoJSON from ${GITHUB_REPOSITORY}" | |
| if git ls-remote --exit-code origin "refs/heads/${BRANCH}" >/dev/null 2>&1; then | |
| git fetch origin "${BRANCH}" --depth=1 || true | |
| git rebase "origin/${BRANCH}" || true | |
| fi | |
| for attempt in 1 2 3; do | |
| if git push -u origin "$BRANCH" --force-with-lease; then | |
| echo "β Push succeeded."; break | |
| fi | |
| echo "β οΈ Push failed (possibly newer remote). Refetching and retryingβ¦" | |
| git fetch origin "${BRANCH}" --depth=1 || true | |
| git rebase "origin/${BRANCH}" || true | |
| sleep 3 | |
| done | |
| - name: π¬ Open or update PR to ottotuhkunen/virtual-lara-airspace-data | |
| run: | | |
| set -euo pipefail | |
| if gh pr view --repo "$UPSTREAM" --head "VATSIM-UK:${BRANCH}" >/dev/null 2>&1; then | |
| gh pr comment --repo "$UPSTREAM" --head "VATSIM-UK:${BRANCH}" \ | |
| --body "Automated update pushed from **${{ github.repository }}** on main." | |
| else | |
| gh pr create \ | |
| --repo "$UPSTREAM" \ | |
| --head "VATSIM-UK:${BRANCH}" \ | |
| --base "main" \ | |
| --title "Update EGXX GeoJSON" \ | |
| --body "Automated update of \`$DEST_PATH\` from **${{ github.repository }}** (main)." | |
| fi |