From bc37622f1d14ad85761700cf73e8265ad3435e27 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Javier=20Mill=C3=A1n=20Acosta?=
 <83466805+jmillanacosta@users.noreply.github.com>
Date: Thu, 18 Jul 2024 12:06:08 +0200
Subject: [PATCH] Update update_datasources.yml

---
 .github/workflows/update_datasources.yml | 27 ++++++++++++++++++------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/update_datasources.yml b/.github/workflows/update_datasources.yml
index 3308f73..a7cb522 100644
--- a/.github/workflows/update_datasources.yml
+++ b/.github/workflows/update_datasources.yml
@@ -40,13 +40,20 @@ jobs:
         env:
           token: ${{ secrets.PAT }}
         run: |
+          # Set Git configuration
           git config --local user.email "action@github.com"  
           git config --local user.name "OmicsFixID bot"
+          # Stage all changes
           git add --all
-          git status
-          git commit -m "Updated data" -m "Artifact URL: ${{ github.event.client_payload.datasource }}"
-          git push -f
-
+          # Check the status and proceed only if there are changes
+          if ! git diff-index --quiet HEAD; then
+          # Commit changes
+            git commit -m "Updated data" -m "Artifact URL: ${{ github.event.client_payload.datasource }}"
+            # Push changes
+            git push -f
+          else
+            echo "No changes to commit."
+          fi
       - name: Update dataSourceVersion
         run: |
           new_date=${{ github.event.client_payload.date }}
@@ -78,6 +85,12 @@ jobs:
           git config --local user.email "action@github.com"  
           git config --local user.name "OmicsFixID bot"
           git add --all
-          git status
-          git commit -m "Updated dataSourceVersion for $datasource"
-          git push -f
+          # Check the status and proceed only if there are changes
+          if ! git diff-index --quiet HEAD; then
+          # Commit changes
+            git commit -m "Updated dataSourceVersion for $datasource"
+            # Push changes
+            git push -f
+          else
+            echo "No changes to commit."
+          fi