Skip to content

Commit

Permalink
Merge pull request #23 from dashcamio/tetst2
Browse files Browse the repository at this point in the history
test2
  • Loading branch information
ianjennings authored Jun 24, 2024
2 parents 47dcd6f + aa5b0ec commit adbaa14
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test PR
name: Test PRa
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]
Expand Down
39 changes: 23 additions & 16 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40074,8 +40074,6 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
let status = response.data.status;
let conclusion = response.data.conclusion;

console.log(chalk.green("TestDriver:"), '"Status:"', status);

return { status, conclusion };
};

Expand All @@ -40092,20 +40090,13 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
conclusion = resp.conclusion;
}

if (conclusion === "failure") {
console.log(
chalk.green("TestDriver:"),
chalk.red('"The workflow has failed!"')
);
}

return conclusion;
};

await waitUntilComplete();
let conc = await waitUntilComplete();

console.log(chalk.green("TestDriver:"), chalk.green('"Done!"'));
console.log(chalk.green("TestDriver:"), '"Writing my report..."'.green);
console.log(chalk.green("TestDriver:"), "Writing my report...");

const {
data: { shareLink, oiResult, exitcode },
Expand All @@ -40118,9 +40109,21 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
}
);

console.log(chalk.green("TestDriver:"), '"Interpreting results..."'.green);
console.log(chalk.green("TestDriver:"), "Interpreting results...");

console.log(chalk.green("TestDriver:"), `"Exit Code ${exitcode}"`.green);
console.log('')
console.log('Test Report:')
if (conc === "failure") {
console.log(
chalk.yellow("Workflow:"),
chalk.red('Fail')
);
} else {
console.log(
chalk.yellow("Workflow:"),
chalk.green('Pass')
);
}

const isPassed = parseInt(exitcode) === 0;

Expand All @@ -40129,27 +40132,31 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
}

if (isPassed) {
console.log(chalk.green("TestDriver:"), chalk.green('"PASS"'));
console.log(chalk.yellow("Test:"), chalk.green('Pass'));
} else {
console.log(chalk.green("TestDriver:"), chalk.red('"FAIL"'));
console.log(chalk.yellow("Test:"), chalk.red('Fail'));
}

let extractedFromMarkdown = extractLink(shareLink);

console.log('')
console.log(chalk.yellow("View Test Result on Dashcam.io:"));

if (extractedFromMarkdown) {
console.log(chalk.yellow("View Test Results on Dashcam.io"));
console.log(extractedFromMarkdown);
} else {
console.log(chalk.red("Something went wrong with Dashcam"));
console.log(shareLink);
}

console.log('')
console.log(chalk.yellow("TestDriver.ai Summary"));
console.log(oiResult);

core.setOutput("summary", oiResult);
core.setOutput("link", extractedFromMarkdown);
core.setOutput("markdown", shareLink);
core.setOutput("success", isPassed);

await core.summary
.addHeading("TestDriver.ai Results")
Expand Down
39 changes: 23 additions & 16 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
let status = response.data.status;
let conclusion = response.data.conclusion;

console.log(chalk.green("TestDriver:"), '"Status:"', status, '"Conclusion:"', conclusion);

return { status, conclusion };
};

Expand All @@ -135,20 +133,13 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
conclusion = resp.conclusion;
}

if (conclusion === "failure") {
console.log(
chalk.green("TestDriver:"),
chalk.red('"The workflow has failed!"')
);
}

return conclusion;
};

await waitUntilComplete();
let conc = await waitUntilComplete();

console.log(chalk.green("TestDriver:"), chalk.green('"Done!"'));
console.log(chalk.green("TestDriver:"), chalk.green('"Writing my report..."'));
console.log(chalk.green("TestDriver:"), "Writing my report...");

const {
data: { shareLink, oiResult, exitcode },
Expand All @@ -161,9 +152,21 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
}
);

console.log(chalk.green("TestDriver:"), chalk.green('"Interpreting results..."'));
console.log(chalk.green("TestDriver:"), "Interpreting results...");

console.log(chalk.green("TestDriver:"), chalk.green(`"Exit Code ${exitcode}"`, typeof exitcode));
console.log('')
console.log('Test Report:')
if (conc === "failure") {
console.log(
chalk.yellow("Workflow:"),
chalk.red('Fail')
);
} else {
console.log(
chalk.yellow("Workflow:"),
chalk.green('Pass')
);
}

const isPassed = parseInt(exitcode) === 0;

Expand All @@ -172,27 +175,31 @@ const waitFor = (ms) => new Promise((r) => setTimeout(r, ms));
}

if (isPassed) {
console.log(chalk.green("TestDriver:"), chalk.green('"PASS"'));
console.log(chalk.yellow("Test:"), chalk.green('Pass'));
} else {
console.log(chalk.green("TestDriver:"), chalk.red('"FAIL"'));
console.log(chalk.yellow("Test:"), chalk.red('Fail'));
}

let extractedFromMarkdown = extractLink(shareLink);

console.log('')
console.log(chalk.yellow("View Test Result on Dashcam.io:"));

if (extractedFromMarkdown) {
console.log(chalk.yellow("View Test Results on Dashcam.io"));
console.log(extractedFromMarkdown);
} else {
console.log(chalk.red("Something went wrong with Dashcam"));
console.log(shareLink);
}

console.log('')
console.log(chalk.yellow("TestDriver.ai Summary"));
console.log(oiResult);

core.setOutput("summary", oiResult);
core.setOutput("link", extractedFromMarkdown);
core.setOutput("markdown", shareLink);
core.setOutput("success", isPassed);

await core.summary
.addHeading("TestDriver.ai Results")
Expand Down
12 changes: 12 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
let exitcode = "0\n"

console.log(exitcode)
console.log(typeof exitcode)

const isPassed = parseInt(exitcode) === 0;

if (!isPassed) {
console.log('failed')
} else {
console.log('passed')
}

0 comments on commit adbaa14

Please sign in to comment.