Skip to content

Commit

Permalink
✨feature: enhance log with group (#36)
Browse files Browse the repository at this point in the history
* ✨feature: enhance log with group

* chore: build, dist updated
  • Loading branch information
maxisam authored Oct 3, 2023
1 parent 6556643 commit 0029957
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
8 changes: 7 additions & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/dotnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,13 @@ function buildArgs(options: IDotnetFormatArgs, onlyChangedFiles: boolean, change
}

export async function execFormat(formatArgs: string[]): Promise<FormatResult> {
core.startGroup('🏃Dotnet Format');
const { stdout, stderr } = await execute('dotnet', process.cwd(), formatArgs, false, true);
// dotnet format returns non-zero exit code if there are formatting issues
// but we don't want to fail the action in this case
// stdout will always end with Format complete ...
// stderr will be empty if there are no formatting issues

core.endGroup();
const result = stdout[stdout.length - 1].includes(FORMAT_COMPLETE);
return { stdout, stderr, formatResult: result };
}
Expand Down Expand Up @@ -106,6 +107,7 @@ export function generateReport(reports: string[]): string {
}

export async function nugetRestore(nugetConfigPath: string, workspace: string): Promise<boolean> {
core.startGroup('📦 Nuget Restore');
const { result } = await execute(
'dotnet restore',
process.cwd(),
Expand All @@ -114,6 +116,7 @@ export async function nugetRestore(nugetConfigPath: string, workspace: string):
false,
false
);
core.endGroup();
return result;
}

Expand Down
7 changes: 4 additions & 3 deletions src/readConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { info } from '@actions/core';
import * as core from '@actions/core';
import deepmerge from 'deepmerge';
import * as fs from 'fs';
import yaml from 'js-yaml';
Expand Down Expand Up @@ -53,7 +53,8 @@ export function readConfig<T>(defaultOptions: Partial<T>, configName: string, wo
if (workspaceConfigExists) {
resultData = deepmerge(resultData, readJSONSync<T>(workspaceConfig), { arrayMerge: arrayMergeDedupe });
}

info(`🔎 loaded config: ${inspect(resultData)}`);
core.startGroup('🔎 Dotnet Format Config');
core.info(`${inspect(resultData)}`);
core.endGroup();
return resultData;
}

0 comments on commit 0029957

Please sign in to comment.