Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic sorting workflow updates and quick test #144

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading