post failure notification

This commit is contained in:
Martin McKeaveney 2022-08-22 13:15:03 +01:00
parent f95ea519a4
commit b9ffa534ca
1 changed files with 4 additions and 7 deletions

View File

@ -5,7 +5,6 @@ const path = require("path")
const fs = require("fs") const fs = require("fs")
const WEBHOOK_URL = process.env.CYPRESS_WEBHOOK_URL const WEBHOOK_URL = process.env.CYPRESS_WEBHOOK_URL
const OUTCOME = process.env.CYPRESS_OUTCOME
const DASHBOARD_URL = process.env.CYPRESS_DASHBOARD_URL const DASHBOARD_URL = process.env.CYPRESS_DASHBOARD_URL
const GIT_SHA = process.env.GITHUB_SHA const GIT_SHA = process.env.GITHUB_SHA
const GITHUB_ACTIONS_RUN_URL = process.env.GITHUB_ACTIONS_RUN_URL const GITHUB_ACTIONS_RUN_URL = process.env.GITHUB_ACTIONS_RUN_URL
@ -35,6 +34,8 @@ async function discordCypressResultsNotification(report) {
skipped, skipped,
} = report.stats } = report.stats
const OUTCOME = failures > 0 ? "failure" : "success"
const options = { const options = {
method: "POST", method: "POST",
headers: { headers: {
@ -123,12 +124,8 @@ async function discordCypressResultsNotification(report) {
} }
async function run() { async function run() {
try { const report = await generateReport()
const report = await generateReport() await discordCypressResultsNotification(report)
await discordCypressResultsNotification(report)
} catch (err) {
console.error(err)
}
} }
run() run()