Skip to content

Commit

Permalink
♻️ Prevet empty commits
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Feb 21, 2021
1 parent 042d13c commit 890bb9f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export const run = async () => {
if (upcomingNotes.length) content += upcomingNotes;
if (pastNotes.length) content += pastNotes;
let readmeContents = await readFile(join(".", "README.md"), "utf-8");
const originalReadmeContents = await readFile(join(".", "README.md"), "utf-8");
readmeContents = `${
readmeContents.split("<!--notes-->")[0]
}<!--notes-->\n\n${content.trim()}\n<!--/notes-->${readmeContents.split("<!--/notes-->")[1]}`;
Expand All @@ -102,7 +103,8 @@ export const run = async () => {
);
if (
Buffer.from(currentContents.data.content, "base64").toString("utf8").trim() !==
readmeContents.trim()
readmeContents.trim() &&
originalReadmeContents.trim() !== format(readmeContents.trim(), { parser: "markdown" }).trim()
)
await octokit.repos.createOrUpdateFileContents({
owner: context.repo.owner,
Expand Down

0 comments on commit 890bb9f

Please sign in to comment.