From 8b65ae697a159af719b09adc73b2fb453e7cdc31 Mon Sep 17 00:00:00 2001 From: Marwane Ezzaze Date: Fri, 19 Jul 2024 23:50:10 +0100 Subject: [PATCH] Adding check on workflow for if the file had changes --- .github/workflows/sort_airports.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/sort_airports.yml b/.github/workflows/sort_airports.yml index 54c3fc1..225c29c 100644 --- a/.github/workflows/sort_airports.yml +++ b/.github/workflows/sort_airports.yml @@ -24,7 +24,19 @@ jobs: - name: Run JSON sorter run: python 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'