mirror of
https://github.com/orhun/git-cliff-action.git
synced 2026-03-22 15:35:44 +08:00
34 lines
734 B
Bash
Executable File
34 lines
734 B
Bash
Executable File
#!/bin/bash -l
|
|
set -uxo pipefail
|
|
|
|
# Avoid file expansion when passing parameters like with '*'
|
|
set -o noglob
|
|
|
|
# Set up working directory
|
|
chown -R root:root .
|
|
|
|
# Create the output directory
|
|
OUTPUT=${OUTPUT:="git-cliff/CHANGELOG.md"}
|
|
mkdir -p "$(dirname $OUTPUT)"
|
|
|
|
# Separate arguments before passing them to git-cliff command
|
|
args=$(echo "$@" | xargs)
|
|
|
|
# Execute git-cliff
|
|
GIT_CLIFF_OUTPUT="$OUTPUT" git-cliff $args
|
|
exit_code=$?
|
|
|
|
# Output to console
|
|
cat "$OUTPUT"
|
|
|
|
# Set the changelog content
|
|
echo "content<<EOF" >> $GITHUB_OUTPUT
|
|
cat "$OUTPUT" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
|
|
# Set output file
|
|
echo "changelog=$OUTPUT" >> $GITHUB_OUTPUT
|
|
|
|
# Pass exit code to the next step
|
|
echo "exit_code=$exit_code" >> $GITHUB_OUTPUT
|