@@ -30564,14 +30564,14 @@ exports.postComment = postComment;
3056430564const core_1 = __nccwpck_require__(2614);
3056530565const SIGNATURE = `<sub>Created with <a href='https://github.com/ZebraDevs/flutter-code-quality'>Flutter code quality action</a></sub>`;
3056630566const createComment = (analyze, test, coverage, behindBy) => {
30567- const isSuccess = !analyze.error && !test.error && !coverage.error && !behindBy.error;
30567+ const isSuccess = !analyze? .error && !test? .error && !coverage? .error && !behindBy? .error;
3056830568 let output = `<h2>PR Checks complete</h2>
3056930569<ul>
3057030570 <li>✅ - Linting / Formatting</li>
30571- <li>${analyze.output.replaceAll("`|\"|'|<|>", "")}</li>
30572- <li>${test.output.replaceAll("`|\"|'|<|>", "")}</li>
30573- ${isSuccess ? "<li>✅ - Branch is not behind</li>" : ""}
30574- <li>${coverage.output.replaceAll("`|\"|'|<|>", "")}</li>
30571+ ${analyze ? ` <li>${analyze? .output.replaceAll("`|\"|'|<|>", "")}</li>` : ""}
30572+ ${test ? ` <li>${test? .output.replaceAll("`|\"|'|<|>", "")}</li>` : ""}
30573+ ${behindBy && isSuccess ? "<li>✅ - Branch is not behind</li>" : ""}
30574+ ${coverage ? ` <li>${coverage? .output.replaceAll("`|\"|'|<|>", "")}</li>` : ""}
3057530575</ul>
3057630576
3057730577${SIGNATURE}
@@ -30685,7 +30685,7 @@ const getCoverage = (oldCoverage) => {
3068530685};
3068630686exports.getCoverage = getCoverage;
3068730687const getOldCoverage = () => {
30688- let value;
30688+ let value = 0 ;
3068930689 (0, core_1.startGroup)("Retrieving existing coverage value");
3069030690 try {
3069130691 const contents = (0, node_fs_1.readFileSync)("coverage/lcov.info", "utf8");
@@ -33153,18 +33153,26 @@ const push_1 = __nccwpck_require__(3662);
3315333153const run = async () => {
3315433154 try {
3315533155 const token = process.env.GITHUB_TOKEN || (0, core_1.getInput)("token");
33156+ const runTests = (0, core_1.getInput)("run-tests");
33157+ const runAnalyze = (0, core_1.getInput)("run-analyze");
33158+ const runCoverage = (0, core_1.getInput)("run-coverage");
33159+ const runBehindBy = (0, core_1.getInput)("run-behind-by");
33160+ const createComment = (0, core_1.getInput)("create-comment");
3315633161 const octokit = (0, github_1.getOctokit)(token);
33157- const behindByStr = await (0, behind_1.checkBranchStatus)(octokit, github_1.context);
33162+ const behindByStr = runBehindBy ? await (0, behind_1.checkBranchStatus)(octokit, github_1.context) : undefined ;
3315833163 await (0, setup_1.setup)();
33159- const oldCoverage = (0, coverage_1.getOldCoverage)();
33160- const analyzeStr = await (0, analyze_1.getAnalyze)();
33161- const testStr = await (0, runTests_1.getTest)();
33162- const coverageStr = (0, coverage_1.getCoverage)(oldCoverage);
33163- const comment = (0, comment_1.createComment)(analyzeStr, testStr, coverageStr, behindByStr);
33164- (0, comment_1.postComment)(octokit, comment, github_1.context);
33164+ const oldCoverage = runCoverage ? (0, coverage_1.getOldCoverage)() : undefined;
33165+ const analyzeStr = runAnalyze ? await (0, analyze_1.getAnalyze)() : undefined;
33166+ const testStr = runTests ? await (0, runTests_1.getTest)() : undefined;
33167+ const coverageStr = runCoverage ? (0, coverage_1.getCoverage)(oldCoverage) : undefined;
33168+ const comment = createComment
33169+ ? (0, comment_1.createComment)(analyzeStr, testStr, coverageStr, behindByStr)
33170+ : undefined;
33171+ if (createComment)
33172+ (0, comment_1.postComment)(octokit, comment, github_1.context);
3316533173 await (0, push_1.push)();
33166- if (analyzeStr.error || testStr.error || coverageStr.error) {
33167- (0, core_1.setFailed)(`${analyzeStr.output}\n${testStr.output}\n${coverageStr.output}`);
33174+ if (analyzeStr? .error || testStr? .error || coverageStr? .error) {
33175+ (0, core_1.setFailed)(`${analyzeStr? .output}\n${testStr? .output}\n${coverageStr? .output}`);
3316833176 }
3316933177 }
3317033178 catch (err) {
0 commit comments