Skip to content

Commit

Permalink
Merge pull request #19 from marcesquerra/FixNixPipeline
Browse files Browse the repository at this point in the history
Ensure hash updating only generates new commit when hash changes
  • Loading branch information
gr211 authored Jul 1, 2024
2 parents 8e8906c + b415cce commit d6f8d90
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/nix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 8 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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;};

Expand Down

0 comments on commit d6f8d90

Please sign in to comment.