|
|
|
@ -196,7 +196,15 @@ jobs:
|
|
|
|
|
console.log('Preparing content updates...');
|
|
|
|
|
// Remove markdown quote character and trim whitespace for both files
|
|
|
|
|
const cleanPrompt = newPrompt.replace(/^>\s*/gm, '').trim();
|
|
|
|
|
const newSection = `## ${actName}\n${contributorInfo}\n\n> ${cleanPrompt}\n\n`;
|
|
|
|
|
|
|
|
|
|
// For README: Add quote to each line
|
|
|
|
|
const readmePrompt = cleanPrompt.split('\n')
|
|
|
|
|
.map(line => `> ${line.trim()}`)
|
|
|
|
|
.join('\n');
|
|
|
|
|
const newSection = `## ${actName}\n${contributorInfo}\n\n${readmePrompt}\n\n`;
|
|
|
|
|
|
|
|
|
|
// For CSV: Convert to single paragraph
|
|
|
|
|
const csvPrompt = cleanPrompt.replace(/\n+/g, ' ').trim();
|
|
|
|
|
|
|
|
|
|
// Insert the new section before Contributors in README
|
|
|
|
|
let readmeContent = Buffer.from(readmeFile.content, 'base64').toString('utf-8');
|
|
|
|
@ -213,7 +221,7 @@ jobs:
|
|
|
|
|
console.log('Preparing CSV content...');
|
|
|
|
|
let csvContent = Buffer.from(csvFile.content, 'base64').toString('utf-8');
|
|
|
|
|
if (!csvContent.endsWith('\n')) csvContent += '\n';
|
|
|
|
|
csvContent += `"${actName.replace(/"/g, '""')}","${cleanPrompt.replace(/"/g, '""')}"`;
|
|
|
|
|
csvContent += `"${actName.replace(/"/g, '""')}","${csvPrompt.replace(/"/g, '""')}"`;
|
|
|
|
|
|
|
|
|
|
// Create new branch
|
|
|
|
|
const branchName = `prompt/${actName.toLowerCase().replace(/[^a-z0-9]+/g, '-')}`;
|
|
|
|
|