Skip to content

Commit 3854068

Browse files
committed
Improve reliability
1 parent 3bedf77 commit 3854068

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

.github/workflows/builds-mastodon.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@ jobs:
3030
export ICON
3131
echo "ICON=\"${ICON}\"" >> $GITHUB_ENV
3232
- name: Trim Body
33+
env:
34+
COMMIT_MESSAGE: ${{ toJSON(github.event.head_commit.message) }}
3335
shell: bash
3436
run: |
35-
BODYLINE='${{ toJSON(github.event.head_commit.message) }}'
37+
BODYLINE="$COMMIT_MESSAGE"
3638
BODYLINE="${BODYLINE#\"}"
3739
BODYLINE="${BODYLINE%\"}"
3840
TRIMMED_BODY="${BODYLINE:0:350}"

.github/workflows/builds-mattermost.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ jobs:
3939
fi
4040
4141
# Properly handle JSON-escaped body - strip outer quotes and truncate
42-
BODYLINE='${{ toJSON(github.event.head_commit.message) }}'
42+
BODYLINE="$BODY"
4343
BODYLINE="${BODYLINE#\"}"
44-
BODYLINE="${BODYLINE%\"}"
44+
BODYLINE="${BODYLINE%\""}
4545
TRIMMED_BODY="${BODYLINE:0:350}"
4646
4747
# Create JSON using jq for proper escaping

.github/workflows/release-mastodon.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,15 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Trim Body
21+
env:
22+
RELEASE_BODY: ${{ toJSON(github.event.release.body) }}
2123
shell: bash
2224
run: |
23-
body="${{ github.event.release.body }}"
25+
body="$RELEASE_BODY"
26+
body="${body#\"}"
27+
body="${body%\"}"
2428
result="${body:0:350}"
25-
echo "BODY=$(echo "${result}")" >> $GITHUB_ENV
29+
echo "BODY=${result}" >> $GITHUB_ENV
2630
- name: Send toot to Mastodon
2731
continue-on-error: true
2832
id: mastodon

0 commit comments

Comments
 (0)