diff --git a/src/index.ts b/src/index.ts index 4a69154..b475e98 100644 --- a/src/index.ts +++ b/src/index.ts @@ -77,18 +77,21 @@ module.exports = (app: Probot) => { repo: "Muunatic", path: "README.MD", ref: "main" - // eslint-disable-next-line @typescript-eslint/no-explicit-any - }).then(async (res: any) => { - const textcontent = `# ɢɪᴛʜᴜʙ sᴛᴀᴛs

\nUpdated ${new Date().toUTCString()} \n\n1. ${event1}\n2. ${event2}\n3. ${event3}\n4. ${event4}\n5. ${event5}`; - await context.octokit.repos.createOrUpdateFileContents({ - content: Buffer.from(textcontent, "utf-8").toString("base64"), - path: "README.md", - message: "Update Activities ✔️", - owner: "Muunatic", - repo: "Muunatic", - branch: "main", - sha: res.data.sha - }); + }).then(async (res) => { + if ("sha" in res.data) { + const textcontent = `# ɢɪᴛʜᴜʙ sᴛᴀᴛs

\nUpdated ${new Date().toUTCString()} \n\n1. ${event1}\n2. ${event2}\n3. ${event3}\n4. ${event4}\n5. ${event5}`; + await context.octokit.repos.createOrUpdateFileContents({ + content: Buffer.from(textcontent, "utf-8").toString("base64"), + path: "README.md", + message: "Update Activities ✔️", + owner: "Muunatic", + repo: "Muunatic", + branch: "main", + sha: res.data.sha + }); + } else { + return; + } }); } }