You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add fix for uncleared spaces around variables and file uploads (#166)
* Trim spaces around environment variables, and resolves#105
* Add ability to send files over slack using an app token, resolves#43
* Prepare for release
Copy file name to clipboardExpand all lines: README.md
+2-1
Original file line number
Diff line number
Diff line change
@@ -61,6 +61,7 @@ SLACK_ON_SUCCESS | - | I
61
61
SLACK_ON_FAILURE | - | If set, will send the provided message instead of the default message when the passed status (through ``SLACK_COLOR``) is `failure`.
62
62
SLACK_ON_CANCEL | - | If set, will send the provided message instead of the default message when the passed status (through ``SLACK_COLOR``) is `cancelled`.
63
63
SLACK_CUSTOM_PAYLOAD | - | If you want to send a custom payload to slack, you can pass it as a string to this variable. This will override all other variables and send the custom payload to slack. Example: `SLACK_CUSTOM_PAYLOAD: '{"text": "Hello, World!"}'`, Note: This payload should be in JSON format, and is not validated by the action.
64
+
SLACK_FILE_UPLOAD | - | If you want to upload a file to slack, you can pass the file path to this variable. Example: `SLACK_FILE_UPLOAD: /path/to/file.txt`. Note: This file should be present in the repository, or github workspace. Otherwise, should be accessable in the container the action is running in.
64
65
ENABLE_ESCAPES | - | If set to `true`, will enable backslash escape sequences such as `\n`, `\t`, etc. in the message. Note: This only works for custom messages and not for the default message generated by the action.
65
66
66
67
@@ -85,7 +86,7 @@ Below screenshot help you visualize message part controlled by different variabl
85
86
86
87
The `Site` and `SSH Host` details are only available if this action is run after [Deploy WordPress GitHub action](https://github.com/rtCamp/action-deploy-wordpress).
87
88
88
-
## Hashicorp Vault (Optional)
89
+
## Hashicorp Vault (Optional) (Deprecated)
89
90
90
91
This GitHub action supports [Hashicorp Vault](https://www.vaultproject.io/).
Copy file name to clipboardExpand all lines: entrypoint.sh
+12
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ if [[ -z "$SLACK_WEBHOOK" ]]; then
8
8
missing_secret="SLACK_WEBHOOK"
9
9
if [[ -n"$VAULT_ADDR" ]] && [[ -n"$VAULT_TOKEN" ]];then
10
10
flag=0
11
+
echo -e "[\e[0;33mWARNING\e[0m] Both \`VAULT_ADDR\` and \`VAULT_TOKEN\` are provided. Using Vault for secrets. This feature is deprecated and will be removed in future versions. Please provide the credentials directly.\n"
11
12
fi
12
13
if [[ -n"$VAULT_ADDR" ]] || [[ -n"$VAULT_TOKEN" ]];then
13
14
missing_secret="VAULT_ADDR and/or VAULT_TOKEN"
@@ -27,6 +28,17 @@ fi
27
28
28
29
export MSG_MODE="$mode"
29
30
31
+
if [[ -n"$SLACK_FILE_UPLOAD" ]];then
32
+
if [[ -z"$SLACK_TOKEN" ]];then
33
+
echo -e "[\e[0;31mERROR\e[0m] Secret \`SLACK_TOKEN\` is missing and a file upload is specified. File Uploads require an application token to be present.\n"
34
+
exit 1
35
+
fi
36
+
if [[ -z"$SLACK_CHANNEL" ]];then
37
+
echo -e "[\e[0;31mERROR\e[0m] Secret \`SLACK_CHANNEL\` is missing and a file upload is specified. File Uploads require a channel to be specified.\n"
Footer: envOr(EnvSlackFooter, "<https://github.com/rtCamp/github-actions-library|Powered By rtCamp's GitHub Actions Library> | <"+os.Getenv(EnvGithubRun)+"|Triggered on this workflow run>"),
Footer: envOr(EnvSlackFooter, "<https://github.com/rtCamp/github-actions-library|Powered By rtCamp's GitHub Actions Library> | <"+getEnv(EnvGithubRun)+"|Triggered on this workflow run>"),
244
247
Fields: fields,
245
248
},
246
249
},
@@ -254,9 +257,13 @@ func main() {
254
257
fmt.Fprintf(os.Stdout, "Successfully sent the message!")
0 commit comments