Printing styled table

This commit is contained in:
Auto Rebase
2025-02-13 21:09:53 +01:00
parent 23bdf3eaa6
commit 3ab283eab9
2 changed files with 10 additions and 9 deletions

16
app.ts
View File

@@ -1,7 +1,7 @@
import { spawn } from "child_process";
import { ChildProcess, SpawnOptions } from "node:child_process";
import {spawn} from "child_process";
import {ChildProcess, SpawnOptions} from "node:child_process";
import * as core from '@actions/core';
import { LogLevel, styledTable, writeConsole } from "@skydust/toolkit";
import {LogLevel, styledTable, writeConsole} from "@skydust/toolkit";
// Ignored branches
const IGNORED_BRANCHES: string[] = core.getInput('branchesToIgnore', { required: false }).split(",");
@@ -297,16 +297,16 @@ const main = async (): Promise<void> => {
}
const failedRebase = rebasedBranches.filter(rebased => !rebased.success)
.map(rebased => [rebased.branch, rebased.onBranch, rebased.action] as string[]);
.map(rebased => [rebased.branch.replace("origin/",""), Action[rebased.action], rebased.onBranch.replace("origin/","")] as string[]);
if(failedRebase.length === 0) {
writeConsole("All rebase where done successfully", LogLevel.INFO);
} else {
writeConsole("Some rebase failed", LogLevel.WARNING);
styledTable([
["Branch", "Action", "Onto branch"],
writeConsole("\nSome rebases failed.", LogLevel.WARNING);
writeConsole(styledTable([
["Branch", "Tried Action", "Onto branch"],
...failedRebase
]);
]), LogLevel.WARNING);
}
} catch (error) {
writeConsole("Error during workflow execution", LogLevel.ERROR);