Skip to content

Commit

Permalink
install-nix.sh: Collapse log messages
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
sigprof committed Jun 26, 2022
1 parent 451e611 commit 6c5ba55
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions install-nix.sh
Expand Up @@ -6,6 +6,9 @@ if type -p nix &>/dev/null ; then
exit
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
workdir=$(mktemp -d)
trap 'rm -rf "$workdir"' EXIT
Expand Down Expand Up @@ -84,3 +87,6 @@ echo "/nix/var/nix/profiles/per-user/$USER/profile/bin" >> "$GITHUB_PATH"
if [[ $INPUT_NIX_PATH != "" ]]; then
echo "NIX_PATH=${INPUT_NIX_PATH}" >> "$GITHUB_ENV"
fi

# Close the log message group which was opened above
echo "::endgroup::"

0 comments on commit 6c5ba55

Please sign in to comment.