Skip to content
This repository has been archived by the owner on Jul 24, 2022. It is now read-only.

Commit

Permalink
Added customizable Slack message text. (#88)
Browse files Browse the repository at this point in the history
* added customizable slack message text

* typo README.md

* bump version

* added messageText property to action.yml

* changed messageText to message-text
  • Loading branch information
grigorii-zander authored Apr 16, 2021
1 parent 4067c6b commit 0ae52d5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 5 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ async function run(): Promise<void> {
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'))
Expand Down Expand Up @@ -84,8 +88,7 @@ async function run(): Promise<void> {
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!')
Expand Down

0 comments on commit 0ae52d5

Please sign in to comment.