diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2023-04-03 19:06:41 +0200 |
---|---|---|
committer | Rory& <root@rory.gay> | 2024-06-05 15:52:38 +0200 |
commit | 8643ce6a17836adc105cafab7a517f575ccde120 (patch) | |
tree | 896e284969ae136439488d8e8108c64d45a60d6b | |
parent | Make delay 30 seconds (diff) | |
download | Spacebar-Open-Infrastructure-8643ce6a17836adc105cafab7a517f575ccde120.tar.xz |
Fix update check
-rw-r--r-- | modules/auto-redeploy.nix | 10 |
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 |