From 926b5964a22742864b99e4fc803be3ad39ba6492 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 6 Jan 2025 00:59:32 +0300 Subject: [PATCH] update --- .github/workflows/ai_bot.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/ai_bot.yml b/.github/workflows/ai_bot.yml index 25d48fb..98b22c3 100644 --- a/.github/workflows/ai_bot.yml +++ b/.github/workflows/ai_bot.yml @@ -231,7 +231,24 @@ jobs: sha: mainRef.object.sha }); + // Get current files from the new branch + console.log('Getting current file SHAs...'); + const { data: currentReadme } = await octokit.repos.getContent({ + owner: event.repository.owner.login, + repo: event.repository.name, + path: 'README.md', + ref: branchName + }); + + const { data: currentCsv } = await octokit.repos.getContent({ + owner: event.repository.owner.login, + repo: event.repository.name, + path: 'prompts.csv', + ref: branchName + }); + // Update files with correct author + console.log('Updating README.md...'); await octokit.repos.createOrUpdateFileContents({ owner: event.repository.owner.login, repo: event.repository.name, @@ -239,6 +256,7 @@ jobs: message: `feat: Add "${actName}" to README`, content: Buffer.from(readmeContent).toString('base64'), branch: branchName, + sha: currentReadme.sha, committer: { name: pr.user.login, email: `${pr.user.login}@users.noreply.github.com` @@ -249,6 +267,7 @@ jobs: } }); + console.log('Updating prompts.csv...'); await octokit.repos.createOrUpdateFileContents({ owner: event.repository.owner.login, repo: event.repository.name, @@ -256,6 +275,7 @@ jobs: message: `feat: Add "${actName}" to prompts.csv`, content: Buffer.from(csvContent).toString('base64'), branch: branchName, + sha: currentCsv.sha, committer: { name: pr.user.login, email: `${pr.user.login}@users.noreply.github.com`