From 94064ffee17784c22674ac3a8334c8408f183d78 Mon Sep 17 00:00:00 2001 From: mwgg Date: Wed, 28 Aug 2024 06:02:07 +0000 Subject: [PATCH] Automatic sorting workflow updates and quick test --- .github/workflows/sort_airports.yml | 70 ++++++++++++++++------------- airports.json | 24 +++++----- 2 files changed, 50 insertions(+), 44 deletions(-) diff --git a/.github/workflows/sort_airports.yml b/.github/workflows/sort_airports.yml index 94c980c..189f338 100644 --- a/.github/workflows/sort_airports.yml +++ b/.github/workflows/sort_airports.yml @@ -17,35 +17,41 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - - name: Run JSON sorter - run: python ./.github/scripts/sort.py airports.json airports.json icao - - - name: Check if airports.json file changed - id: file_changed - run: | - if git diff --exit-code airports.json; then - echo "File did not change" - echo "changed=false" >> $GITHUB_ENV - else - echo "File was changed" - echo "changed=true" >> $GITHUB_ENV - fi - - - name: Commit and push changes - if: env.changed == 'true' - run: | - git config --global user.name 'github-actions' - git config --global user.email 'github-actions@github.com' - git add airports.json - git commit -m 'Automatically sorted Airports JSON file' - git push - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: false + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + + - name: Run JSON sorter + run: python ./.github/scripts/sort.py airports.json airports.json icao + + - name: Check if airports.json file changed + id: file_changed + run: | + if git diff --exit-code airports.json; then + echo "File did not change" + echo "changed=false" >> $GITHUB_ENV + else + echo "File was changed" + echo "changed=true" >> $GITHUB_ENV + fi + + - name: Commit changes + if: env.changed == 'true' + run: | + git config --global user.name 'github-actions' + git config --global user.email 'github-actions@github.com' + git add airports.json + git commit -m 'Automatically sorted Airports JSON file' + + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} diff --git a/airports.json b/airports.json index d116c8b..69618da 100644 --- a/airports.json +++ b/airports.json @@ -350795,18 +350795,6 @@ "lon": 121.5390014648, "tz": "Asia/Shanghai" }, - "ZYTN": { - "icao": "ZYTN", - "iata": "TNH", - "name": "Tonghua Sanyuanpu Airport", - "city": "Tonghua", - "state": "Jilin", - "country": "CN", - "elevation": 1200, - "lat": 42.2538888889, - "lon": 125.703333333, - "tz": "Asia/Shanghai" - }, "ZYTX": { "icao": "ZYTX", "iata": "SHE", @@ -350819,6 +350807,18 @@ "lon": 123.483001709, "tz": "Asia/Shanghai" }, + "ZYTN": { + "icao": "ZYTN", + "iata": "TNH", + "name": "Tonghua Sanyuanpu Airport", + "city": "Tonghua", + "state": "Jilin", + "country": "CN", + "elevation": 1200, + "lat": 42.2538888889, + "lon": 125.703333333, + "tz": "Asia/Shanghai" + }, "ZYXC": { "icao": "ZYXC", "iata": "XEN",