Skip to content

Commit

Permalink
Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
emcfarlane committed Jul 5, 2024
1 parent 3dd790a commit ec43efe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45939,14 +45939,15 @@ async function format(bufPath, inputs) {
args.push("--exclude-path", path);
}
const result = await run(bufPath, args);
if (result.status == Status.Failed) {
if (result.status == Status.Failed && result.stdout.startsWith("diff")) {
// If the format step fails, parse the diff and write github annotations.
const diff = parse_diff(result.stdout);
result.stdout = ""; // Clear the stdout.
console.log("diff", diff);
for (const file of diff) {
result.stdout += `::error file=${file.to}::Format failed -${file.deletions} +${file.additions} changes.\n`;
}
console.log(result.stdout);
}
return result;
}
Expand Down
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,14 +229,15 @@ async function format(bufPath: string, inputs: Inputs): Promise<Result> {
args.push("--exclude-path", path);
}
const result = await run(bufPath, args);
if (result.status == Status.Failed) {
if (result.status == Status.Failed && result.stdout.startsWith("diff")) {
// If the format step fails, parse the diff and write github annotations.
const diff = parseDiff(result.stdout);
result.stdout = ""; // Clear the stdout.
console.log("diff", diff);
for (const file of diff) {
result.stdout += `::error file=${file.to}::Format failed -${file.deletions} +${file.additions} changes.\n`;
}
console.log(result.stdout);
}
return result;
}
Expand Down

0 comments on commit ec43efe

Please sign in to comment.