feat: add rollback_on_failure feature #88

Merged
Philipp merged 3 commits from feature/rollback-on-failure into main 2026-05-17 13:13:59 +02:00
2 changed files with 11 additions and 7 deletions
Showing only changes of commit 0212889604 - Show all commits
+1 -1
View File
File diff suppressed because one or more lines are too long
+10 -6
View File
1
@@ -237,12 +237,16 @@ export async function postCode() {
Philipp marked this conversation as resolved
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
// 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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

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.

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,
1
@@ -253,17 +257,17 @@ export async function postCode() {
Philipp marked this conversation as resolved
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

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",
);
1
Philipp marked this conversation as resolved
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.
Review

The api.auth call is now explicitly awaited outside the conditional block. This is cleaner than the previous .then() chain.

The `api.auth` call is now explicitly awaited outside the conditional block. This is cleaner than the previous `.then()` chain.