feat: add rollback_on_failure feature #88
@@ -237,12 +237,16 @@ export async function postCode() {
|
||||
|
Philipp marked this conversation as resolved
|
||||
// Console monitoring (optional)
|
||||
const monitorTicks = parseInt(core.getInput("monitor") || "0", 10);
|
||||
if (monitorTicks > 0) {
|
||||
const onTraceback = core.getInput("on_traceback") || "fail";
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
const onErrorLog = core.getInput("on_error_log") || "warn";
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
const onWarningLog = core.getInput("on_warning_log") || "ignore";
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
const result = await monitorConsole(api, {
|
||||
monitor: monitorTicks,
|
||||
logToFile: core.getBooleanInput("log_to_file"),
|
||||
onTraceback: core.getInput("on_traceback") || "fail",
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
onErrorLog: core.getInput("on_error_log") || "warn",
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
onWarningLog: core.getInput("on_warning_log") || "ignore",
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
onTraceback,
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
onErrorLog,
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
onWarningLog,
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
monitorInterval: parseInt(core.getInput("monitor_interval") || "10", 10),
|
||||
hostname,
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
This block duplicates the logic found inside This block duplicates the logic found inside `applyOnAction`. While necessary to determine if a rollback should occur before the final `setFailed` call, it might be worth refactoring to avoid inconsistent behavior if more failure conditions are added in the future.
|
||||
shard: core.getInput("shard") || undefined,
|
||||
@@ -253,17 +257,17 @@ export async function postCode() {
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
core.setOutput("saw_warning_log", String(result.sawWarningLog));
|
||||
|
||||
const fail1 = applyOnAction(
|
||||
core.getInput("on_traceback") || "fail",
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
onTraceback,
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
result.sawTraceback,
|
||||
"Screeps console: traceback detected",
|
||||
);
|
||||
const fail2 = applyOnAction(
|
||||
core.getInput("on_error_log") || "warn",
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
onErrorLog,
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
result.sawErrorLog,
|
||||
"Screeps console: error log output detected",
|
||||
);
|
||||
const fail3 = applyOnAction(
|
||||
core.getInput("on_warning_log") || "ignore",
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
onWarningLog,
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
result.sawWarningLog,
|
||||
"Screeps console: warning log output detected",
|
||||
);
|
||||
|
||||
|
Philipp marked this conversation as resolved
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
AutoReview
commented
The The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
|
||||
The
api.authcall is now explicitly awaited outside the conditional block. This is cleaner than the previous.then()chain.The
api.authcall is now explicitly awaited outside the conditional block. This is cleaner than the previous.then()chain.