From d79fa84609e0c64e22e4b3756d4731503f17a68e Mon Sep 17 00:00:00 2001 From: Spirillen <44526987+spirillen@users.noreply.github.com> Date: Sat, 18 Jan 2025 13:52:18 +0100 Subject: [PATCH] Bot optimized the script, lets test it test v.1.0.a --- .github/workflows/sort.yml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/sort.yml b/.github/workflows/sort.yml index 3f668520879..8c10301d448 100644 --- a/.github/workflows/sort.yml +++ b/.github/workflows/sort.yml @@ -25,10 +25,21 @@ jobs: run: | pip install --no-cache-dir -r "${{ github.workspace }}/requirements.txt" - - name: Sort the lists + - name: Check for changes in source folder + id: check_changes run: | + if git diff --name-only HEAD~1 HEAD | grep '^source/'; then + echo "changes=true" >> $GITHUB_ENV + else + echo "changes=false" >> $GITHUB_ENV + fi + + - name: Run Fates Script + if: env.changes == 'true' + continue-on-error: true + run: | + # sudo apt-get install -y fates python3 tools/sort_lists.py - continue-on-error: true - name: Configure Git run: | @@ -37,9 +48,14 @@ jobs: git config --global --add safe.directory /github/workspace - name: Commit changes + if: env.changes == 'true' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - git add . - git commit -m "Sorted files" - git push + if git diff --staged --quiet; then + echo "We are good, no changes to the sources" + else + git add . + git commit -m "Sorted files" + git push + fi