summary refs log tree commit diff
path: root/modules/auto-redeploy.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/auto-redeploy.nix')
-rw-r--r--modules/auto-redeploy.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/auto-redeploy.nix b/modules/auto-redeploy.nix
index fef352c..3ea187c 100644
--- a/modules/auto-redeploy.nix
+++ b/modules/auto-redeploy.nix
@@ -10,8 +10,14 @@
               cd /Spacebar-Open-Architecture
               #store current commit hash
               currentCommit=$(git rev-parse HEAD)
-              #pull from git, and exit if nothing to pull
-              ${pkgs.git}/bin/git pull || exit 0
+              git fetch --all
+              #check if there are any new commits
+              if [ $(git rev-parse HEAD) = $(git rev-parse @{u}) ]; then
+                echo "Already up-to-date"
+                exit 0
+              fi
+              #pull new commits
+              git pull
               #send commit log to discord
               ${pkgs.curl}/bin/curl -H "Content-Type: application/json" -d '{"username": "${config.networking.hostName} - redeploy", "content": "```$(git log --pretty=format:"%h - %s" $currentCommit..HEAD)```"}' ${secrets.webhooks.discord.deploy}
               #call ./update.sh and store output (including stderr) in a file