Skip to content

Commit 898d46e

Browse files
committed
Strip trailing whitespace in output
1 parent 04c1e60 commit 898d46e

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

pr-checks/sync.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,17 @@ function writeYaml(filePath: string, data: any): void {
109109
quotingType: "'", // Use single quotes where quoting is needed
110110
forceQuotes: false,
111111
});
112-
fs.writeFileSync(filePath, header + yamlStr, "utf8");
112+
fs.writeFileSync(filePath, stripTrailingWhitespace(header + yamlStr), "utf8");
113+
}
114+
115+
/**
116+
* Strip trailing whitespace from each line.
117+
*/
118+
function stripTrailingWhitespace(content: string): string {
119+
return content
120+
.split("\n")
121+
.map((line) => line.trimEnd())
122+
.join("\n");
113123
}
114124

115125
/**

0 commit comments

Comments
 (0)