🐛 fix(ci): replace head_commit.message expression with git log (shell injection) #38
@@ -299,13 +299,11 @@ jobs:
|
||||
# Check for version bump on main branch
|
||||
if [ "${{ github.ref }}" = "refs/heads/main" ]; then
|
||||
echo "🔖 Checking for version bump..."
|
||||
# ${{ github.event.head_commit.message }} is empty on workflow_dispatch (manual trigger).
|
||||
# Fall back to the latest commit message from `git log` so the script always has input.
|
||||
COMMIT_MSG="${{ github.event.head_commit.message }}"
|
||||
if [ -z "$COMMIT_MSG" ]; then
|
||||
COMMIT_MSG=$(git log -1 --pretty=%B)
|
||||
echo " (using git log -1 because head_commit.message is empty - probably workflow_dispatch)"
|
||||
fi
|
||||
# Always read from git log: ${{ github.event.head_commit.message }} expression
|
||||
# is interpolated literally into the shell script, so any backtick, unbalanced
|
||||
# quote, or special char in a commit body breaks the next line of the script
|
||||
# (observed on PR #32-#35: 'syntax error: unexpected newline'). git log is safe.
|
||||
COMMIT_MSG=$(git log -1 --pretty=%B)
|
||||
./scripts/ci-version-bump.sh "$COMMIT_MSG" --no-push
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user