mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 06:47:09 +01:00
add slack
This commit is contained in:
parent
86a2010147
commit
1d5276a2d9
4 changed files with 764 additions and 1048 deletions
|
|
@ -76,6 +76,10 @@ inputs:
|
|||
description: GitHub Access Token
|
||||
required: false
|
||||
default: ${{ github.token }}
|
||||
slack-url:
|
||||
description: Slack webhook url
|
||||
required: false
|
||||
default: ${{ slack.url }}
|
||||
outputs:
|
||||
conclusion:
|
||||
description: |
|
||||
|
|
|
|||
1799
package-lock.json
generated
1799
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -32,9 +32,10 @@
|
|||
"author": "Michal Dorner <dorner.michal@gmail.com>",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/core": "^1.2.6",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@slack/webhook": "^6.0.0",
|
||||
"adm-zip": "^0.5.10",
|
||||
"fast-glob": "^3.3.2",
|
||||
"got": "^11.8.2",
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import {SwiftXunitParser} from './parsers/swift-xunit/swift-xunit-parser'
|
|||
|
||||
import {normalizeDirPath, normalizeFilePath} from './utils/path-utils'
|
||||
import {getCheckRunContext} from './utils/github-utils'
|
||||
import { IncomingWebhook } from '@slack/webhook'
|
||||
|
||||
async function main(): Promise<void> {
|
||||
try {
|
||||
|
|
@ -44,6 +45,7 @@ class TestReporter {
|
|||
readonly workDirInput = core.getInput('working-directory', {required: false})
|
||||
readonly onlySummary = core.getInput('only-summary', {required: false}) === 'true'
|
||||
readonly token = core.getInput('token', {required: true})
|
||||
readonly slackWebhook = core.getInput('slack-url', {required: false})
|
||||
readonly octokit: InstanceType<typeof GitHub>
|
||||
readonly context = getCheckRunContext()
|
||||
|
||||
|
|
@ -206,6 +208,10 @@ class TestReporter {
|
|||
core.setOutput('url', resp.data.url)
|
||||
core.setOutput('url_html', resp.data.html_url)
|
||||
|
||||
if (isFailed && this.slackWebhook) {
|
||||
const webhook = new IncomingWebhook(this.slackWebhook);
|
||||
await webhook.send("Test run failed: " + resp.data.html_url);
|
||||
}
|
||||
return results
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue