From aea78a2a3af99e953817bf95520f15309920c2af Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Sun, 15 Nov 2020 00:18:25 +0530 Subject: [PATCH] :recycle: Format markdown file with Prettier --- src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 2516364..a623383 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,6 +3,7 @@ import { context, getOctokit } from "@actions/github"; import { GitHub } from "@actions/github/lib/utils"; import { readdir, readFile } from "fs-extra"; import { join } from "path"; +import { format } from "prettier"; interface Note { slug: string; @@ -90,7 +91,9 @@ export const run = async () => { repo: context.repo.repo, path: "README.md", }); - const base64Content = Buffer.from(readmeContents).toString("base64"); + const base64Content = Buffer.from(format(readmeContents.trim(), { parser: "markdown" })).toString( + "base64" + ); if ( Buffer.from(currentContents.data.content, "base64").toString("utf8").trim() !== readmeContents.trim()