Skip to content

Commit

Permalink
Fix host diffing
Browse files Browse the repository at this point in the history
Git treats the path as absolute whilst, at leas to my understanding, the
nix flake manual specifies that this ath can be relative. Thus
explicitly setting the current working directory as the path.
  • Loading branch information
e1mo committed Feb 6, 2024
1 parent bec7752 commit 807dec7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/scripts/diff-hosts.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
#
debug="${ACTIONS_STEP_DEBUG-false}"
set -x
if $debug; then
set -x
else
Expand Down Expand Up @@ -41,14 +42,15 @@ fi

before_rev="$(git rev-parse "$before_ref")"
before_rev_abbr="$before_ref"
before_flake="git+file:.?ref=${before_rev}"
# Relative flake git flake urls don't work (right now?) because git treats the path as absolute
before_flake="git+file:$(pwd)?rev=${before_rev}"

after_rev="$(git rev-parse --verify HEAD)"
after_rev_abbr="$(git rev-parse --abbrev-ref HEAD)"
if [[ -z $(git status --short) ]]; then
# If the working tree is clean, we can use the latest commit hash directly
# and thus profit from even more reduced build times
after_flake="git+file:.?ref=${after_rev}"
after_flake="git+file:$(pwd)?rev=${after_rev}"
else
# That way the script can be used to check local (non commited) changes
after_flake="."
Expand Down

0 comments on commit 807dec7

Please sign in to comment.