Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure hash updating only generates new commit when hash changes #19

Merged
merged 1 commit into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading