Skip to content

Commit 96fddbe

Browse files
authored
fix: revert multiline yaml parsing indentation change (#638)
#637
1 parent e1f137c commit 96fddbe

5 files changed

Lines changed: 53 additions & 29 deletions

File tree

‎.changeset/revert-js-yaml-4x.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@slack/slack-github-action": patch
3+
---
4+
5+
fix: revert multiline yaml parsing indentation change

‎.github/workflows/integration.yml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,24 @@ jobs:
103103
env:
104104
MESSAGE_OUTPUT_TS: ${{ steps.message.outputs.ts }}
105105

106+
- name: "test(api): post a multiline message" # https://github.com/slackapi/slack-github-action/issues/637
107+
id: multiline
108+
uses: ./
109+
with:
110+
errors: true
111+
method: chat.postMessage
112+
token: ${{ secrets.SLACK_BOT_TOKEN }}
113+
payload: |
114+
channel: ${{ secrets.SLACK_CHANNEL_ID }}
115+
text: ":checkered_flag: A multiline message wraps across lines
116+
117+
with a blank line before <https://github.com/${{ github.repository }}|a link>"
118+
119+
- name: "test(api): confirm the multiline message was posted"
120+
run: test -n "$MULTILINE_OUTPUT_TS"
121+
env:
122+
MULTILINE_OUTPUT_TS: ${{ steps.multiline.outputs.ts }}
123+
106124
- name: "test(api): post a message with blocks"
107125
id: blocks
108126
uses: ./

‎package-lock.json‎

Lines changed: 13 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@
4949
"@slack/webhook": "^7.2.0",
5050
"flat": "^6.0.1",
5151
"https-proxy-agent": "^9.0.0",
52-
"js-yaml": "^5.2.0",
52+
"js-yaml": "^4.2.0",
5353
"markup-js": "^1.5.21"
5454
},
5555
"devDependencies": {
5656
"@biomejs/biome": "^2.5.1",
5757
"@changesets/cli": "^2.31.0",
5858
"@types/flat": "^5.0.5",
59+
"@types/js-yaml": "^4.0.9",
5960
"@types/markup-js": "^1.5.0",
6061
"@types/node": "^24.13.2",
6162
"@types/sinon": "^21.0.0",

‎test/content.spec.js‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,21 @@ describe("content", () => {
7171
assert.deepEqual(config.content.values, expected);
7272
});
7373

74+
/**
75+
* @see {@link https://github.com/slackapi/slack-github-action/issues/637}
76+
*/
77+
it("parses multiline YAML from the input payload", async () => {
78+
mocks.core.getInput
79+
.withArgs("payload")
80+
.returns('channel: C0123456789\ntext: "first line\n\nsecond line"');
81+
const config = new Config(mocks.core);
82+
const expected = {
83+
channel: "C0123456789",
84+
text: "first line\nsecond line",
85+
};
86+
assert.deepEqual(config.content.values, expected);
87+
});
88+
7489
it("parses complete JSON from the input payload", async () => {
7590
mocks.core.getInput.withArgs("payload").returns(`{
7691
"message": "this is wrapped",

0 commit comments

Comments
 (0)