mirror of
https://github.com/github/codeql-action.git
synced 2026-01-01 04:00:24 +08:00
Introduce withGroupAsync()
This commit is contained in:
@@ -41,6 +41,18 @@ export function withGroup<T>(groupName: string, f: () => T): T {
|
||||
}
|
||||
}
|
||||
|
||||
export async function withGroupAsync<T>(
|
||||
groupName: string,
|
||||
f: () => Promise<T>,
|
||||
): Promise<T> {
|
||||
core.startGroup(groupName);
|
||||
try {
|
||||
return await f();
|
||||
} finally {
|
||||
core.endGroup();
|
||||
}
|
||||
}
|
||||
|
||||
/** Format a duration for use in logs. */
|
||||
export function formatDuration(durationMs: number) {
|
||||
if (durationMs < 1000) {
|
||||
|
||||
Reference in New Issue
Block a user