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 5f6b241
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/scripts/diff-hosts.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env bash
#
set -x
debug="${ACTIONS_STEP_DEBUG-false}"
if $debug; then
set -x
else
set +x
fi
set -x

# host_exists(flake, host)
# Checks if ${flake}#nixosConfigurations.$host
Expand Down Expand Up @@ -41,14 +43,18 @@ 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}"

# Somehow this doesn't work (anymore??)
after_flake="git+file://$(pwd)?rev=${after_rev}"
after_flake="."
else
# That way the script can be used to check local (non commited) changes
after_flake="."
Expand Down

0 comments on commit 5f6b241

Please sign in to comment.