mirror of
https://github.com/orhun/git-cliff-action.git
synced 2026-03-24 00:15:43 +08:00
fix(install): fix running on windows host (#43)
Co-authored-by: Yegor Bayev <233409+kodx@users.noreply.github.com>
This commit is contained in:
18
run.sh
18
run.sh
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user