From d589cb711ea26983e7e11fdb389acc3ffd738ce3 Mon Sep 17 00:00:00 2001 From: TSRBerry <20988865+TSRBerry@users.noreply.github.com> Date: Fri, 20 Oct 2023 15:01:56 +0200 Subject: [PATCH] Only create a new commit if stats changed --- .github/workflows/label-stats.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/label-stats.yml b/.github/workflows/label-stats.yml index b581bee..848c199 100644 --- a/.github/workflows/label-stats.yml +++ b/.github/workflows/label-stats.yml @@ -59,10 +59,21 @@ jobs: ${{ steps.stats.outputs.result }} $EOF - - name: Commit stats + - name: Configure git run: | git config user.name github-actions[bot] git config user.email 41898282+github-actions[bot]@users.noreply.github.com + + - name: Check if files have been modified + id: mod_check + run: | + [[ $(git status -s | wc -l) -le 1 ]] \ + && echo "is-dirty=false" >> "$GITHUB_OUTPUT" \ + || echo "is-dirty=true" >> "$GITHUB_OUTPUT" + + - name: Commit and push stats + if: steps.mod_check.outputs.is-dirty == 'true' + run: | git add . git commit -m "Update compat-stats.json" git push