deploy-notify-slack 0.4.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +3 -1
  2. package/notify.js +5 -2
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -17,6 +17,8 @@ You can use default message template with the following env variables:
17
17
 
18
18
  - TITLE - ('Deployment' by default) notification title
19
19
  - CHANGELOG_PATH - path of your deployed version details file (`changelog` by default as well as we assume that the package installed locally, so this option is required if the package installed globally)
20
+ - COLOR - ('#7f8583' by default) left bar notification color. Should be hex color code without `#` symbol
21
+ - EMOJI - (':rocket:' by default) emoji to be displayed in the notification title
20
22
 
21
23
  > version details file is a Markdown file having the name like `${STAGE}-v${VERSION}.md`.
22
24
  >
@@ -156,4 +158,4 @@ Then you can run the script with the following command:
156
158
  npm i --location=global deploy-notify-slack@latest
157
159
  CUSTOM_MESSAGE=$(cat message.json)
158
160
  SLACK_WEBHOOK_URL=${SLACK_WEBHOOK_URL} CUSTOM_MESSAGE=$CUSTOM_MESSAGE node /usr/local/lib/node_modules/deploy-notify-slack/notify.js
159
- ```
161
+ ```
package/notify.js CHANGED
@@ -6,6 +6,8 @@ const slackWebHookURL = process.env.SLACK_WEBHOOK_URL;
6
6
  const stage = process.env.STAGE;
7
7
  const version = process.env.VERSION;
8
8
  const title = process.env.TITLE || 'Deployment';
9
+ const color = process.env.COLOR || '7f8583';
10
+ const emoji = process.env.EMOJI || ':rocket:';
9
11
  const customMessage = process.env.CUSTOM_MESSAGE;
10
12
  const changelogPath = process.env.CHANGELOG_PATH || path.join(__dirname, '../../changelog');
11
13
  const failsIfNotSent = process.env.FAILS_IF_NOT_SENT !== undefined
@@ -37,7 +39,7 @@ function notificationBody() {
37
39
  "type": "section",
38
40
  "text": {
39
41
  "type": "mrkdwn",
40
- "text": `:rocket: *${title}*`
42
+ "text": `${emoji} *${title}*`
41
43
  }
42
44
  },
43
45
  {
@@ -85,6 +87,7 @@ function notificationBody() {
85
87
  return {
86
88
  "attachments": [
87
89
  {
90
+ "color": `#${color}`,
88
91
  "blocks": blocks
89
92
  }
90
93
  ]
@@ -236,4 +239,4 @@ function validate() {
236
239
  process.exit(5);
237
240
  }
238
241
  }
239
- })();
242
+ })();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deploy-notify-slack",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Send Slack notification about deploy with version comments",
5
5
  "main": "notify.js",
6
6
  "scripts": {