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 15, 2024
1 parent bec7752 commit d31dbf7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/scripts/diff-hosts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,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 Expand Up @@ -107,9 +111,10 @@ for host in "${all_hosts[@]}"; do
{
echo '```';
$diff_cmd --show-trace | sed -e 's/\x1b\[[0-9;]*m//g';
echo "";
echo '```';
echo -e "\n</details>\n";
} >> "$step_summary" 2>&1
} >> "$step_summary"
else
echo -e "**${host}** has not changed\n" | tee -a "$step_summary"
fi
Expand Down

0 comments on commit d31dbf7

Please sign in to comment.