Skip to content

Commit 0d1862b

Browse files
committed
Fix shell escaping in Mastodon workflow body parsing
Replace unsafe echo/sed pattern with bash parameter expansion to prevent shell metacharacter interpretation errors. Fixes syntax errors when commit messages contain parentheses or other special characters.
1 parent 70ec786 commit 0d1862b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

.github/workflows/builds-mastodon.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,11 @@ jobs:
3232
- name: Trim Body
3333
shell: bash
3434
run: |
35-
BODYLINE=$(echo '${{ toJSON(github.event.head_commit.message) }}' | sed 's/^\"//g' | sed 's/\"$//g' )
36-
echo "BODY=$(echo "${BODYLINE}" | cut -c1-350 )" >> $GITHUB_ENV
35+
BODYLINE='${{ toJSON(github.event.head_commit.message) }}'
36+
BODYLINE="${BODYLINE#\"}"
37+
BODYLINE="${BODYLINE%\"}"
38+
TRIMMED_BODY="${BODYLINE:0:350}"
39+
echo "BODY=${TRIMMED_BODY}" >> $GITHUB_ENV
3740
- name: Send toot to Mastodon
3841
id: mastodon
3942
continue-on-error: true

0 commit comments

Comments
 (0)