duplicate
This commit is contained in:
parent
bc8d21f521
commit
29ac367fcb
|
@ -144,6 +144,8 @@ jobs:
|
||||||
return `Act as ${title}`;
|
return `Act as ${title}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// First try to find prompts in README
|
||||||
|
let foundInReadme = false;
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
console.log(`Processing file: ${file.filename}`);
|
console.log(`Processing file: ${file.filename}`);
|
||||||
if (file.filename === 'README.md') {
|
if (file.filename === 'README.md') {
|
||||||
|
@ -166,24 +168,30 @@ jobs:
|
||||||
|
|
||||||
prompts.set(actName.toLowerCase(), { actName, promptText, contributorInfo });
|
prompts.set(actName.toLowerCase(), { actName, promptText, contributorInfo });
|
||||||
console.log(`Found prompt in README: "${actName}"`);
|
console.log(`Found prompt in README: "${actName}"`);
|
||||||
|
foundInReadme = true;
|
||||||
}
|
}
|
||||||
} else if (file.filename === 'prompts.csv') {
|
}
|
||||||
const patch = file.patch || '';
|
}
|
||||||
const addedLines = patch.split('\n')
|
|
||||||
.filter(line => line.startsWith('+'))
|
|
||||||
.map(line => line.substring(1))
|
|
||||||
.filter(line => line.trim()); // Remove empty lines
|
|
||||||
|
|
||||||
console.log('Attempting to extract prompts from CSV changes...');
|
// Only look in CSV if we didn't find anything in README
|
||||||
for (const line of addedLines) {
|
if (!foundInReadme) {
|
||||||
// Parse CSV line considering escaped quotes
|
console.log('No prompts found in README, checking CSV...');
|
||||||
const matches = [...line.matchAll(/"([^"]*(?:""[^"]*)*)"/g)];
|
for (const file of files) {
|
||||||
if (matches.length >= 2) {
|
if (file.filename === 'prompts.csv') {
|
||||||
const actName = normalizeTitle(matches[0][1].replace(/""/g, '"').trim());
|
const patch = file.patch || '';
|
||||||
const promptText = matches[1][1].replace(/""/g, '"').trim();
|
const addedLines = patch.split('\n')
|
||||||
|
.filter(line => line.startsWith('+'))
|
||||||
// Only add if not already found in README
|
.map(line => line.substring(1))
|
||||||
if (!prompts.has(actName.toLowerCase())) {
|
.filter(line => line.trim()); // Remove empty lines
|
||||||
|
|
||||||
|
console.log('Attempting to extract prompts from CSV changes...');
|
||||||
|
for (const line of addedLines) {
|
||||||
|
// Parse CSV line considering escaped quotes
|
||||||
|
const matches = [...line.matchAll(/"([^"]*(?:""[^"]*)*)"/g)];
|
||||||
|
if (matches.length >= 2) {
|
||||||
|
const actName = normalizeTitle(matches[0][1].replace(/""/g, '"').trim());
|
||||||
|
const promptText = matches[1][1].replace(/""/g, '"').trim();
|
||||||
|
|
||||||
const contributorInfo = `Contributed by: [@${pr.user.login}](https://github.com/${pr.user.login})`;
|
const contributorInfo = `Contributed by: [@${pr.user.login}](https://github.com/${pr.user.login})`;
|
||||||
prompts.set(actName.toLowerCase(), { actName, promptText, contributorInfo });
|
prompts.set(actName.toLowerCase(), { actName, promptText, contributorInfo });
|
||||||
console.log(`Found prompt in CSV: "${actName}"`);
|
console.log(`Found prompt in CSV: "${actName}"`);
|
||||||
|
|
Loading…
Reference in New Issue