
* Add slack notification * Add correct webhook url * Create new file with helpers * add default * add missing checkout
26 lines
815 B
JavaScript
26 lines
815 B
JavaScript
const core = require("@actions/core");
|
|
const { Command } = require("commander");
|
|
const { statusAndID } = require("./getTestsResults");
|
|
const { failedTestCases } = require("./getTestsResults");
|
|
|
|
const program = new Command();
|
|
|
|
program
|
|
.name("Get failed test")
|
|
.description("Get info if notify on slack if tests failed")
|
|
.option("--dashboard_url <dashboard_url>", "Cypress dashboard url")
|
|
.action(async options => {
|
|
const data = await statusAndID(options.dashboard_url);
|
|
|
|
let testsStatus = data.status;
|
|
|
|
if (testsStatus === "FAILED") {
|
|
const testCases = await failedTestCases(data.runId);
|
|
if (testCases.length >= 20) {
|
|
core.setOutput("notifySlack", "true");
|
|
}
|
|
} else if (testsStatus === "FAILED") {
|
|
core.setOutput("notifySlack", "true");
|
|
}
|
|
})
|
|
.parse();
|