Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/revert-js-yaml-4x.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@slack/slack-github-action": patch
---

fix: revert multiline yaml parsing indentation change
18 changes: 18 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,24 @@ jobs:
env:
MESSAGE_OUTPUT_TS: ${{ steps.message.outputs.ts }}

- name: "test(api): post a multiline message" # https://github.com/slackapi/slack-github-action/issues/637
id: multiline
uses: ./
with:
errors: true
method: chat.postMessage
token: ${{ secrets.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ secrets.SLACK_CHANNEL_ID }}
text: ":checkered_flag: A multiline message wraps across lines

with a blank line before <https://github.com/${{ github.repository }}|a link>"

- name: "test(api): confirm the multiline message was posted"
run: test -n "$MULTILINE_OUTPUT_TS"
env:
MULTILINE_OUTPUT_TS: ${{ steps.multiline.outputs.ts }}

- name: "test(api): post a message with blocks"
id: blocks
uses: ./
Expand Down
41 changes: 13 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@
"@slack/webhook": "^7.2.0",
"flat": "^6.0.1",
"https-proxy-agent": "^9.0.0",
"js-yaml": "^5.2.0",
"js-yaml": "^4.2.0",
"markup-js": "^1.5.21"
},
"devDependencies": {
"@biomejs/biome": "^2.5.1",
"@changesets/cli": "^2.31.0",
"@types/flat": "^5.0.5",
"@types/js-yaml": "^4.0.9",
"@types/markup-js": "^1.5.0",
"@types/node": "^24.13.2",
"@types/sinon": "^21.0.0",
Expand Down
15 changes: 15 additions & 0 deletions test/content.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@ describe("content", () => {
assert.deepEqual(config.content.values, expected);
});

/**
* @see {@link https://github.com/slackapi/slack-github-action/issues/637}
*/
it("parses multiline YAML from the input payload", async () => {
mocks.core.getInput
.withArgs("payload")
.returns('channel: C0123456789\ntext: "first line\n\nsecond line"');
const config = new Config(mocks.core);
const expected = {
channel: "C0123456789",
text: "first line\nsecond line",
};
assert.deepEqual(config.content.values, expected);
});

it("parses complete JSON from the input payload", async () => {
mocks.core.getInput.withArgs("payload").returns(`{
"message": "this is wrapped",
Expand Down
Loading