Skip to content

Commit

Permalink
Simplify format result check
Browse files Browse the repository at this point in the history
  • Loading branch information
xt0rted committed Mar 4, 2020
1 parent 3b9feeb commit 3dd3cf8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function check(): Promise<void> {
onlyChangedFiles,
});

setOutput("has-changes", (!!result).toString());
setOutput("has-changes", result.toString());

// fail fast will cause the workflow to stop on this job
if (result && failFast) {
Expand All @@ -27,5 +27,5 @@ export async function fix(): Promise<void> {
onlyChangedFiles,
});

setOutput("has-changes", (!!result).toString());
setOutput("has-changes", result.toString());
}
6 changes: 3 additions & 3 deletions src/dotnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function formatOnlyChangedFiles(onlyChangedFiles: boolean): boolean {
return false;
}

export async function format(options: FormatOptions): Promise<number> {
export async function format(options: FormatOptions): Promise<boolean> {
const execOptions: ExecOptions = {
ignoreReturnCode: true,
};
Expand All @@ -45,7 +45,7 @@ export async function format(options: FormatOptions): Promise<number> {
// if there weren't any files to check then we need to bail
if (!filesToCheck.length) {
debug("No files found for formatting");
return 0;
return false;
}

dotnetFormatOptions.push("--files", filesToCheck.join(","));
Expand All @@ -54,5 +54,5 @@ export async function format(options: FormatOptions): Promise<number> {
const dotnetPath: string = await which("dotnet", true);
const dotnetResult = await exec(`"${dotnetPath}"`, dotnetFormatOptions, execOptions);

return dotnetResult;
return !!dotnetResult;
}

0 comments on commit 3dd3cf8

Please sign in to comment.