Skip to content

Commit 4d75288

Browse files
committed
Do not commit when generated README is the same as the current one
1 parent 1b0fe61 commit 4d75288

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

dist/index.js

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/generate.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ export default async function generateReadme(inputs: KeyValueStore) {
5656
const sha = getReadme.data.sha;
5757
if (sha === undefined) throw new Error("Commit SHA is undefined");
5858

59+
// @ts-ignore
60+
const readmeContents = Buffer.from((getReadme.data.content as string | undefined) ?? "", 'base64').toString();
61+
5962
const data = `
6063
# ${queryKeyValuePairs["header"]}
6164
@@ -72,6 +75,11 @@ ${inputs["setOfProjectsCollectionId"] !== undefined && queryResult.data.setOfPro
7275
${queryKeyValuePairs["footer"]}
7376
`;
7477

78+
if(readmeContents === data) {
79+
console.log("No changes made to README output, so not creating a commit");
80+
return;
81+
}
82+
7583
await octokit.request('PUT /repos/{owner}/{repo}/contents/{path}', {
7684
owner: username,
7785
repo: repo,

0 commit comments

Comments
 (0)