-
Notifications
You must be signed in to change notification settings - Fork 186
51 lines (43 loc) · 1.25 KB
/
sort_airports.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Sort JSON
on:
push:
branches:
- master
pull_request:
branches:
- master
types:
- closed
jobs:
sort-json:
if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
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 }}