Skip to content
This repository was archived by the owner on Jul 1, 2024. It is now read-only.

Commit b52c4ed

Browse files
committed
Show differences from the required form
1 parent 97d0bb2 commit b52c4ed

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/pr-info.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,18 @@ function makeJsonCheckerFromCore(requiredForm: any, ignoredKeys: string[]) {
419419
const newDiff = diffFromReq(contents);
420420
if (typeof newDiff === "string") return newDiff;
421421
if (newDiff.length === 0) return undefined;
422-
if (!oldText) return "not the required form";
422+
if (!oldText) return `not the required form
423+
\`\`\`JSON
424+
${JSON.stringify(newDiff)}
425+
\`\`\``;
423426
const oldDiff = diffFromReq(oldText);
424427
if (typeof oldDiff === "string") return oldDiff;
425-
if (jsonDiff.compare(oldDiff, newDiff).every(({ op }) => op === "remove")) return undefined;
426-
return "not the required form and not moving towards it";
428+
const notRemove = jsonDiff.compare(oldDiff, newDiff).filter(({ op }) => op !== "remove");
429+
if (notRemove.length === 0) return undefined;
430+
return `not the required form and not moving towards it
431+
\`\`\`JSON
432+
${JSON.stringify(notRemove.map(({ path }) => newDiff[Number(path.slice(1))]))}
433+
\`\`\``;
427434
};
428435
}
429436

0 commit comments

Comments
 (0)