install-nix.sh: Collapse log messages

The Nix installer produces a significant number of log messages, but
usually those messages are not really interesting.  Group those messages
under a header, so that GitHub will keep them collapsed by default.

(Usually log messages are collapsed under the step title anyway, but if
this action is uses inside another composite action, there is no
separate step title, therefore the whole Nix installer output is
immediately visible when the log section for the outer composite action
is expanded.  Adding the group header fixes this problem.)
This commit is contained in:
Sergey Vlasov 2022-06-27 00:23:14 +03:00
parent 451e611838
commit 6c5ba55bfd

View file

@ -6,6 +6,9 @@ if type -p nix &>/dev/null ; then
exit exit
fi fi
# GitHub command to put the following log messages into a group which is collapsed by default
echo "::group::Installing Nix"
# Create a temporary workdir # Create a temporary workdir
workdir=$(mktemp -d) workdir=$(mktemp -d)
trap 'rm -rf "$workdir"' EXIT trap 'rm -rf "$workdir"' EXIT
@ -84,3 +87,6 @@ echo "/nix/var/nix/profiles/per-user/$USER/profile/bin" >> "$GITHUB_PATH"
if [[ $INPUT_NIX_PATH != "" ]]; then if [[ $INPUT_NIX_PATH != "" ]]; then
echo "NIX_PATH=${INPUT_NIX_PATH}" >> "$GITHUB_ENV" echo "NIX_PATH=${INPUT_NIX_PATH}" >> "$GITHUB_ENV"
fi fi
# Close the log message group which was opened above
echo "::endgroup::"