fix(install): fix running on windows host (#43)

Co-authored-by: Yegor Bayev <233409+kodx@users.noreply.github.com>
This commit is contained in:
Yegor Bayev
2024-12-04 19:45:31 +03:00
committed by GitHub
parent e364f07989
commit 4a4a951bc4
2 changed files with 26 additions and 13 deletions

18
run.sh
View File

@@ -5,6 +5,12 @@ set -uxo pipefail
# Avoid file expansion when passing parameters like with '*'
set -o noglob
GIT_CLIFF_BIN='git-cliff'
if [[ "${RUNNER_OS}" == 'Windows' ]]; then
GIT_CLIFF_BIN="${GIT_CLIFF_BIN}.exe"
fi
# Set up working directory
owner=$(stat -c "%u:%g" .)
chown -R "$(id -u)" .
@@ -17,12 +23,12 @@ mkdir -p "$(dirname $OUTPUT)"
args=$(echo "$@" | xargs)
# Execute git-cliff
GIT_CLIFF_OUTPUT="$OUTPUT" ./bin/git-cliff $args
GIT_CLIFF_OUTPUT="$OUTPUT" ./bin/${GIT_CLIFF_BIN} $args
exit_code=$?
# Retrieve context
CONTEXT="$(mktemp)"
GIT_CLIFF_OUTPUT="$CONTEXT" ./bin/git-cliff $args --context
GIT_CLIFF_OUTPUT="$CONTEXT" ./bin/${GIT_CLIFF_BIN} $args --context
# Revert permissions
chown -R "$owner" .
@@ -31,10 +37,10 @@ chown -R "$owner" .
FILESIZE=$(stat -c%s "$OUTPUT")
MAXSIZE=$((40 * 1024 * 1024))
if [ "$FILESIZE" -le "$MAXSIZE" ]; then
echo "content<<EOF" >>$GITHUB_OUTPUT
cat "$OUTPUT" >>$GITHUB_OUTPUT
echo "EOF" >>$GITHUB_OUTPUT
cat "$OUTPUT"
echo "content<<EOF" >>$GITHUB_OUTPUT
cat "$OUTPUT" >>$GITHUB_OUTPUT
echo "EOF" >>$GITHUB_OUTPUT
cat "$OUTPUT"
fi
# Set output file