From 5de96ffd2135f0808638ef2fc28c6250e753ddd7 Mon Sep 17 00:00:00 2001
From: michael litschauer <michael.litschauer@gmail.com>
Date: Tue, 18 Feb 2025 09:20:04 +0100
Subject: [PATCH] added condition to push only if there are changes

---
 .github/workflows/export-mongodb.yml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/export-mongodb.yml b/.github/workflows/export-mongodb.yml
index a91a883..2aa5a49 100644
--- a/.github/workflows/export-mongodb.yml
+++ b/.github/workflows/export-mongodb.yml
@@ -39,9 +39,15 @@ jobs:
           git config --global user.name 'github-actions[bot]'
           git config --global user.email 'github-actions[bot]@users.noreply.github.com'
 
+      - name: Check for changes
+        id: git_diff
+        run: |
+            git add exports/*.json
+            git diff-index --quiet HEAD || echo "changes"
+
       - name: Commit and push changes
+        if: steps.git_diff.outputs.changes == 'changes'
         run: |
-          git add gendercomics/*.json
           git commit -m "Export MongoDB collections as JSON files"
           git push
         env:
-- 
GitLab