From bafde83eb9e2c7ac4b57e9936e051f860020ba57 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 6 Jan 2025 01:54:52 +0300 Subject: [PATCH] lowercase --- .github/workflows/ai_bot.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ai_bot.yml b/.github/workflows/ai_bot.yml index 1a3372e..b79f52f 100644 --- a/.github/workflows/ai_bot.yml +++ b/.github/workflows/ai_bot.yml @@ -309,7 +309,9 @@ jobs: owner: event.repository.owner.login, repo: event.repository.name, path: 'README.md', - message: `feat: Add "${prompts[0].actName}" to README`, + message: prompts.length === 1 + ? `feat: Add "${prompts[0].actName}" to README` + : `feat: Add multiple prompts to README`, content: Buffer.from(readmeContent).toString('base64'), branch: branchName, sha: currentReadme.sha, @@ -328,7 +330,9 @@ jobs: owner: event.repository.owner.login, repo: event.repository.name, path: 'prompts.csv', - message: `feat: Add "${prompts[0].actName}" to prompts.csv`, + message: prompts.length === 1 + ? `feat: Add "${prompts[0].actName}" to prompts.csv` + : `feat: Add multiple prompts to prompts.csv`, content: Buffer.from(csvContent).toString('base64'), branch: branchName, sha: currentCsv.sha, @@ -343,13 +347,21 @@ jobs: }); // Create new PR + const prTitle = prompts.length === 1 + ? `feat: Add "${prompts[0].actName}"` + : `feat: Add multiple prompts (${prompts.map(p => `"${p.actName}"`).join(', ')})`; + + const prBody = prompts.length === 1 + ? `This PR supersedes #${issueNumber} with proper formatting. Original PR by @${pr.user.login}. Added "${prompts[0].actName}" to README.md and prompts.csv, preserving original attribution.` + : `This PR supersedes #${issueNumber} with proper formatting. Original PR by @${pr.user.login}.\n\nAdded the following prompts:\n${prompts.map(p => `- "${p.actName}"`).join('\n')}\n\nAll prompts have been added to README.md and prompts.csv, preserving original attribution.`; + const { data: newPr } = await octokit.pulls.create({ owner: event.repository.owner.login, repo: event.repository.name, - title: `feat: Add "${prompts[0].actName}"`, + title: prTitle, head: branchName, base: 'main', - body: `This PR supersedes #${issueNumber} with proper formatting. Original PR by @${pr.user.login}. Added "${prompts[0].actName}" to README.md and prompts.csv, preserving original attribution.` + body: prBody }); // Comment on original PR