diff --git a/entrypoint.sh b/entrypoint.sh index e8c0fed..458f259 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -4,10 +4,9 @@ set -uxo pipefail # Avoid file expansion when passing parameters like with '*' set -o noglob -# Set up permissions -if [[ $(id -u) -ne $(stat -c '%u' .) ]]; then - eids=$(stat -c '--euid %u --egid %g' .) -fi +# Set up working directory +owner=$(stat -c "%u:%g" .) +chown -R "$(id -u)" . # Create the output directory OUTPUT=${OUTPUT:="git-cliff/CHANGELOG.md"} @@ -17,12 +16,15 @@ mkdir -p "$(dirname $OUTPUT)" args=$(echo "$@" | xargs) # Execute git-cliff -GIT_CLIFF_OUTPUT="$OUTPUT" ${eids:+setpriv --clear-groups $eids} git-cliff $args +GIT_CLIFF_OUTPUT="$OUTPUT" git-cliff $args exit_code=$? # Output to console cat "$OUTPUT" +# Revert permissions +chown -R "$owner" . + # Set the changelog content echo "content<> $GITHUB_OUTPUT cat "$OUTPUT" >> $GITHUB_OUTPUT