Skip to content

Commit

Permalink
Merge pull request #144 from mwgg/2024_08_28_sorting
Browse files Browse the repository at this point in the history
Automatic sorting workflow updates and quick test
  • Loading branch information
mwgg authored Aug 28, 2024
2 parents 5379139 + 94064ff commit 132bf94
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 44 deletions.
70 changes: 38 additions & 32 deletions .github/workflows/sort_airports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 '[email protected]'
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 '[email protected]'
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 }}
24 changes: 12 additions & 12 deletions airports.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 132bf94

Please sign in to comment.