From acc5535cb33a16989d1b80e663202f7784dfde1c Mon Sep 17 00:00:00 2001 From: currenjin Date: Fri, 26 Jan 2024 00:28:40 +0900 Subject: [PATCH] Fix: workflows --- .github/workflows/convert-yml-to-md.js | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/.github/workflows/convert-yml-to-md.js b/.github/workflows/convert-yml-to-md.js index e493d37..5edd3f6 100644 --- a/.github/workflows/convert-yml-to-md.js +++ b/.github/workflows/convert-yml-to-md.js @@ -16,22 +16,13 @@ const initContent = ` function generateMarkdown(categories, sites) { let markdown = initContent; - - categories.forEach((category, index) => { - const categoryName = category.text; - const depth = index + 2; - - markdown += `${'#'.repeat(depth)} ${categoryName}\n`; - + categories.forEach(category => { const categorySites = sites.filter(site => site.categories.includes(category.category)); + markdown += `## ${category.text}\n`; categorySites.forEach(site => { - const { name, link, description } = site; - markdown += `${'#'.repeat(depth + 1)} [${name}](${link}) - ${description}\n`; + markdown += `- [${site.name}](${site.link}) - ${site.description}\n`; }); - - markdown += '\n'; }); - return markdown; } @@ -41,7 +32,5 @@ const categories = yaml.load(categoriesContent); const sitesContent = fs.readFileSync('./sites.yml', 'utf-8'); const sites = yaml.load(sitesContent); -const generatedMarkdown = generateMarkdown(categories, sites); - -fs.writeFileSync('./README.md', generatedMarkdown, 'utf8'); - +const readmeContent = generateMarkdown(categories, sites); +fs.writeFileSync('./README.md', readmeContent);