From 0ae52d56d7260016fd80dd2beada4a9484cea913 Mon Sep 17 00:00:00 2001 From: Grigorii Zander Date: Fri, 16 Apr 2021 19:25:29 +0300 Subject: [PATCH] Added customizable Slack message text. (#88) * added customizable slack message text * typo README.md * bump version * added messageText property to action.yml * changed messageText to message-text --- README.md | 6 ++++++ action.yml | 3 +++ package.json | 2 +- src/main.ts | 7 +++++-- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 52e2eb5..7f41f47 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,12 @@ But if your project uses Cypress in a subfolder (like most monorepos), you'll ne (i.e. `e2e/cypress`). (Don't include a trailing slash on your path!) +### `message-text` + +**Optional** Custom Slack message text. + +Default: `A Cypress test just finished. I've placed the screenshots and videos in this thread. Good pie!` + ## Examples ### Upload results after every push diff --git a/action.yml b/action.yml index af93c18..073fa08 100644 --- a/action.yml +++ b/action.yml @@ -13,6 +13,9 @@ inputs: workdir: description: 'The path of the directory where Cypress stores its screenshots. Defaults to `./cypress`. No trailing slashes, please.' required: false + message-text: + description: 'Custom Slack message text' + required: false outputs: result: description: 'Result of video and screenshot uploads' diff --git a/package.json b/package.json index b94bf0b..0f042b3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cypress-slack-video-upload-action", - "version": "1.1.1", + "version": "1.2.0", "private": true, "description": "Github action that takes the generated screenshots and videos from a Cypress test and uploads them to Slack", "main": "lib/main.js", diff --git a/src/main.ts b/src/main.ts index 748fa50..e239286 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,9 +9,13 @@ async function run(): Promise { const token = core.getInput('token') const channels = core.getInput('channels') const workdir = core.getInput('workdir') || 'cypress' + const messageText = + core.getInput('message-text') || + "A Cypress test just finished. I've placed the screenshots and videos in this thread. Good pie!" core.debug(`Token: ${token}`) core.debug(`Channels: ${channels}`) + core.debug(`Message text: ${messageText}`) core.debug('Initializing slack SDK') const slack = new WebClient(core.getInput('token')) @@ -84,8 +88,7 @@ async function run(): Promise { await slack.chat.update({ ts: threadID, channel: channelId, - text: - "A Cypress test just finished. I've placed the screenshots and videos in this thread. Good pie!" + text: messageText }) core.setOutput('result', 'Bingo bango bongo!')