Skip to content

Commit c118c16

Browse files
committed
Fix Mattermost notification JSON parsing error
Fixed "Expected property name or '}' in JSON at position 1" error in Mattermost notification workflows by updating to modern GitHub Actions output syntax. Changes: - Replace deprecated ::set-output with $GITHUB_OUTPUT - Use PAYLOAD: |- multiline YAML syntax for proper JSON handling - Applied to both pullrequest-mattermost.yaml and issues-mattermost.yaml - Matches the working pattern in builds-mattermost.yaml The deprecated ::set-output command doesn't properly handle JSON with newlines and special characters. The new approach using $GITHUB_OUTPUT and multiline YAML syntax preserves JSON structure correctly.
1 parent 1b25758 commit c118c16

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

.github/workflows/issues-mattermost.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,10 @@ jobs:
6262
}' > mattermost.json
6363
- name: Read Content
6464
id: getcontent
65-
run: echo "::set-output name=payload::$(cat mattermost.json)"
65+
run: echo "payload=$(cat mattermost.json)" >> $GITHUB_OUTPUT
6666
- name: Send Mattermost Message
6767
uses: mattermost/action-mattermost-notify@master
6868
with:
6969
MATTERMOST_WEBHOOK_URL: ${{ secrets.WEBHOOK || secrets.MATTERMOST_WEBHOOK_URL }}
70-
PAYLOAD: ${{ steps.getcontent.outputs.payload }}
70+
PAYLOAD: |-
71+
${{ steps.getcontent.outputs.payload }}

.github/workflows/pullrequest-mattermost.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ jobs:
4242
cat mattermost.json
4343
- name: Read Content
4444
id: getcontent
45-
run: echo "::set-output name=payload::$(cat mattermost.json)"
45+
run: echo "payload=$(cat mattermost.json)" >> $GITHUB_OUTPUT
4646
- name: Send Mattermost Message
4747
uses: mattermost/action-mattermost-notify@master
4848
with:
4949
MATTERMOST_WEBHOOK_URL: ${{ secrets.WEBHOOK || secrets.MATTERMOST_WEBHOOK_URL }}
50-
PAYLOAD: ${{ steps.getcontent.outputs.payload }}
50+
PAYLOAD: |-
51+
${{ steps.getcontent.outputs.payload }}

0 commit comments

Comments
 (0)