-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure that the backslash+n char sequences are converted to the `\…
…n` newline escape char in the message texts (#17) * Make sure that the backslash+n char sequences are converted to the `\n` newline escape char in the message texts Related discussion: https://discuss.bitrise.io/t/slack-step-does-not-treat-n-as-a-newline-when-message-generated-by-a-bash-script-step/1776 * go deps update
- Loading branch information
1 parent
9add234
commit 053d908
Showing
31 changed files
with
5,504 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ workflows: | |
do-vendor-update: | ||
steps: | ||
- script: | ||
title: go deps update | ||
inputs: | ||
- content: | | ||
#!/bin/bash | ||
|
@@ -17,6 +18,8 @@ workflows: | |
rm -rf ./Godeps | ||
rm -rf ./vendor | ||
go get -t -d ./... | ||
go get github.com/davecgh/go-spew/spew | ||
go get github.com/pmezard/go-difflib/difflib | ||
godep save ./... | ||
fail-message-test: | ||
steps: | ||
|
@@ -85,6 +88,13 @@ workflows: | |
bitrise share finish | ||
test: | ||
steps: | ||
- script: | ||
title: go test | ||
inputs: | ||
- content: | | ||
#!/bin/bash | ||
set -ex | ||
go test ./... | ||
- path::./: | ||
title: On Success | ||
is_skippable: false | ||
|
@@ -134,3 +144,20 @@ workflows: | |
and _some_ *highlight* | ||
- color: good | ||
- image_url: https://media.giphy.com/media/6brH8dM3zeMyA/giphy.gif | ||
- [email protected]: | ||
title: Generate SLACK_MESSAGE_FROM_SCRIPT | ||
inputs: | ||
- content: |- | ||
#!/bin/bash | ||
set -ex | ||
multi_line_msg="Multi\nline\n\ntext" | ||
envman add --key SLACK_MESSAGE_FROM_SCRIPT --value "$multi_line_msg" | ||
- path::./: | ||
title: Should escape backslash+n as newline char | ||
is_skippable: false | ||
inputs: | ||
- webhook_url: $SLACK_WEBHOOK_URL | ||
- channel: $SLACK_CHANNEL | ||
- from_username: step-dev-test | ||
- message: $SLACK_MESSAGE_FROM_SCRIPT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package main | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func Test_ensureNewlineEscapeChar(t *testing.T) { | ||
require.Equal(t, "", ensureNewlineEscapeChar("")) | ||
require.Equal(t, "a", ensureNewlineEscapeChar("a")) | ||
require.Equal(t, "\n", ensureNewlineEscapeChar("\n")) | ||
require.Equal(t, "\n", ensureNewlineEscapeChar("\\"+"n")) | ||
// should convert \ + n to \n too; where \n is a single char, the ASCII 10 "newline feed" char | ||
require.Equal(t, uint8(10), ensureNewlineEscapeChar("\n")[0]) | ||
require.Equal(t, uint8(10), ensureNewlineEscapeChar("\\" + "n")[0]) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.