mirror of
https://github.com/orhun/git-cliff-action.git
synced 2026-03-22 15:35:44 +08:00
refactor(action): further simplify git safe directory workaround
This commit is contained in:
@@ -4,9 +4,10 @@ set -uxo pipefail
|
|||||||
# Avoid file expansion when passing parameters like with '*'
|
# Avoid file expansion when passing parameters like with '*'
|
||||||
set -o noglob
|
set -o noglob
|
||||||
|
|
||||||
# Set up working directory
|
# Set up permissions
|
||||||
owner=$(stat -c "%u:%g" .)
|
if [[ $(id -u) -ne $(stat -c '%u' .) ]]; then
|
||||||
chown -R "$(id -u)" .
|
eids=$(stat -c '--euid %u --egid %g' .)
|
||||||
|
fi
|
||||||
|
|
||||||
# Create the output directory
|
# Create the output directory
|
||||||
OUTPUT=${OUTPUT:="git-cliff/CHANGELOG.md"}
|
OUTPUT=${OUTPUT:="git-cliff/CHANGELOG.md"}
|
||||||
@@ -16,15 +17,12 @@ mkdir -p "$(dirname $OUTPUT)"
|
|||||||
args=$(echo "$@" | xargs)
|
args=$(echo "$@" | xargs)
|
||||||
|
|
||||||
# Execute git-cliff
|
# Execute git-cliff
|
||||||
GIT_CLIFF_OUTPUT="$OUTPUT" git-cliff $args
|
GIT_CLIFF_OUTPUT="$OUTPUT" ${eids:+setpriv --clear-groups $eids} git-cliff $args
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
|
|
||||||
# Output to console
|
# Output to console
|
||||||
cat "$OUTPUT"
|
cat "$OUTPUT"
|
||||||
|
|
||||||
# Revert permissions
|
|
||||||
chown -R "$owner" .
|
|
||||||
|
|
||||||
# Set the changelog content
|
# Set the changelog content
|
||||||
echo "content<<EOF" >> $GITHUB_OUTPUT
|
echo "content<<EOF" >> $GITHUB_OUTPUT
|
||||||
cat "$OUTPUT" >> $GITHUB_OUTPUT
|
cat "$OUTPUT" >> $GITHUB_OUTPUT
|
||||||
|
|||||||
Reference in New Issue
Block a user