@kakarot-ci/core 0.6.3 → 0.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +70 -31
- package/dist/cli/index.js.map +2 -2
- package/dist/index.cjs +70 -31
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +70 -31
- package/dist/index.js.map +2 -2
- package/dist/src/core/orchestrator.d.ts.map +1 -1
- package/dist/src/github/client.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -230,6 +230,8 @@ var GitHubClient = class {
|
|
|
230
230
|
this.retryDelay = 1e3;
|
|
231
231
|
this.owner = options.owner;
|
|
232
232
|
this.repo = options.repo;
|
|
233
|
+
const originalConsoleError = console.error;
|
|
234
|
+
const originalConsoleWarn = console.warn;
|
|
233
235
|
this.octokit = new import_rest.Octokit({
|
|
234
236
|
auth: options.token,
|
|
235
237
|
request: {
|
|
@@ -237,6 +239,8 @@ var GitHubClient = class {
|
|
|
237
239
|
retryAfter: this.retryDelay / 1e3
|
|
238
240
|
}
|
|
239
241
|
});
|
|
242
|
+
console.error = originalConsoleError;
|
|
243
|
+
console.warn = originalConsoleWarn;
|
|
240
244
|
}
|
|
241
245
|
/**
|
|
242
246
|
* Retry wrapper with exponential backoff
|
|
@@ -245,6 +249,10 @@ var GitHubClient = class {
|
|
|
245
249
|
try {
|
|
246
250
|
return await fn();
|
|
247
251
|
} catch (err) {
|
|
252
|
+
const isNotFound = err && typeof err === "object" && "status" in err && err.status === 404;
|
|
253
|
+
if (isNotFound) {
|
|
254
|
+
throw err;
|
|
255
|
+
}
|
|
248
256
|
if (retries <= 0) {
|
|
249
257
|
error(`${operation} failed after ${this.maxRetries} retries: ${err instanceof Error ? err.message : String(err)}`);
|
|
250
258
|
throw err;
|
|
@@ -431,25 +439,46 @@ var GitHubClient = class {
|
|
|
431
439
|
* Check if a file exists in the repository
|
|
432
440
|
*/
|
|
433
441
|
async fileExists(ref, path) {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
442
|
+
const originalError = console.error;
|
|
443
|
+
const originalWarn = console.warn;
|
|
444
|
+
const suppressedError = (...args) => {
|
|
445
|
+
const message = args.join(" ");
|
|
446
|
+
if (!message.includes("404") && !message.includes("Not Found")) {
|
|
447
|
+
originalError(...args);
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
const suppressedWarn = (...args) => {
|
|
451
|
+
const message = args.join(" ");
|
|
452
|
+
if (!message.includes("404") && !message.includes("Not Found")) {
|
|
453
|
+
originalWarn(...args);
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
try {
|
|
457
|
+
console.error = suppressedError;
|
|
458
|
+
console.warn = suppressedWarn;
|
|
459
|
+
await this.octokit.rest.repos.getContent({
|
|
460
|
+
owner: this.owner,
|
|
461
|
+
repo: this.repo,
|
|
462
|
+
path,
|
|
463
|
+
ref
|
|
464
|
+
});
|
|
465
|
+
return true;
|
|
466
|
+
} catch (err) {
|
|
467
|
+
const status = err && typeof err === "object" && "status" in err ? err.status : void 0;
|
|
468
|
+
if (status === 404) {
|
|
469
|
+
return false;
|
|
470
|
+
}
|
|
471
|
+
if (err instanceof Error) {
|
|
472
|
+
const message = err.message.toLowerCase();
|
|
473
|
+
if (message.includes("404") || message.includes("not found")) {
|
|
448
474
|
return false;
|
|
449
475
|
}
|
|
450
|
-
throw err;
|
|
451
476
|
}
|
|
452
|
-
|
|
477
|
+
throw err;
|
|
478
|
+
} finally {
|
|
479
|
+
console.error = originalError;
|
|
480
|
+
console.warn = originalWarn;
|
|
481
|
+
}
|
|
453
482
|
}
|
|
454
483
|
/**
|
|
455
484
|
* Get the current rate limit status
|
|
@@ -1976,21 +2005,31 @@ async function runPullRequest(context) {
|
|
|
1976
2005
|
if (testFiles.size > 0) {
|
|
1977
2006
|
const testRunner = createTestRunner(framework);
|
|
1978
2007
|
const writtenPaths = Array.from(testFiles.keys());
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
2008
|
+
try {
|
|
2009
|
+
info("Running tests with coverage...");
|
|
2010
|
+
const finalTestResults = await testRunner.runTests({
|
|
2011
|
+
testFiles: writtenPaths,
|
|
2012
|
+
framework,
|
|
2013
|
+
packageManager,
|
|
2014
|
+
projectRoot,
|
|
2015
|
+
coverage: true
|
|
2016
|
+
});
|
|
2017
|
+
const coverageReport = readCoverageReport(projectRoot, framework);
|
|
2018
|
+
if (coverageReport) {
|
|
2019
|
+
info(`Coverage collected: ${coverageReport.total.lines.percentage.toFixed(1)}% lines`);
|
|
2020
|
+
summary.coverageReport = coverageReport;
|
|
2021
|
+
summary.testResults = finalTestResults;
|
|
2022
|
+
} else {
|
|
2023
|
+
warn("Could not read coverage report");
|
|
2024
|
+
}
|
|
2025
|
+
} catch (err) {
|
|
2026
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
2027
|
+
if (errorMessage.includes("coverage") || errorMessage.includes("MISSING DEPENDENCY")) {
|
|
2028
|
+
warn(`Coverage collection failed (likely missing coverage package): ${errorMessage}`);
|
|
2029
|
+
warn("Continuing without coverage report");
|
|
2030
|
+
} else {
|
|
2031
|
+
throw err;
|
|
2032
|
+
}
|
|
1994
2033
|
}
|
|
1995
2034
|
}
|
|
1996
2035
|
if (config.enableAutoCommit && testFiles.size > 0) {
|