diff --git a/.github/workflows/nix.yml b/.github/workflows/nix.yml index 0d77546..228ffc9 100644 --- a/.github/workflows/nix.yml +++ b/.github/workflows/nix.yml @@ -18,7 +18,3 @@ jobs: - run: | export WORKSPACE="${PWD}" nix run .#upgrade-nix-gohip - git config --global user.name 'autobot' - git config --global user.email 'gohip.nix@github.com' - git commit -am "[skip ci] Automated nix hash update" - git push diff --git a/flake.nix b/flake.nix index a3897cc..73d49c8 100644 --- a/flake.nix +++ b/flake.nix @@ -24,9 +24,17 @@ upgrade-nix-gohip-package = pkgs.writeShellScriptBin "upgrade-nix-gohip" '' echo "UPGRADING" + OLD_HASH_FILE=`cat $WORKSPACE/gohip.vendor.hash.nix` echo "pkgs : pkgs.lib.fakeHash" > $WORKSPACE/gohip.vendor.hash.nix NEW_HASH=`nix build .#default 2>&1 | grep " got: " | awk '{print $2}'` echo "pkgs : \"$NEW_HASH\"" > $WORKSPACE/gohip.vendor.hash.nix + NEW_HASH_FILE=`cat $WORKSPACE/gohip.vendor.hash.nix` + if [[ "$OLD_HASH_FILE" != "$NEW_HASH_FILE" ]]; then + git config --global user.name 'autobot' + git config --global user.email 'gohip.nix@github.com' + git commit -am "[skip ci] Automated nix hash update" + git push + fi ''; custom-packages = {upgrade-nix-gohip = upgrade-nix-gohip-package;};