diff --git a/.github/scripts/generate-index-recipes.js b/.github/scripts/generate-index-recipes.js index 2beb77c7f..0b91bbc24 100644 --- a/.github/scripts/generate-index-recipes.js +++ b/.github/scripts/generate-index-recipes.js @@ -1,7 +1,7 @@ const fs = require('fs-extra'); const path = require('path'); const crypto = require('crypto'); - + async function generateIndex() { const recipesDir = path.join(__dirname, '../../docs/recipes'); const outputPath = path.join(recipesDir, 'index.json'); @@ -14,7 +14,7 @@ async function generateIndex() { console.log(`Reading files from ${recipesDir}`); for (const file of files) { - if (file.endsWith('.md')) { + if (file.endsWith('.md') && file !== 'README.md') { console.log(`Processing file: ${file}`); const filePath = path.join(recipesDir, file); const content = await fs.readFile(filePath, 'utf-8'); @@ -49,6 +49,9 @@ async function generateIndex() { console.log(`Writing README to ${readmePath}`); await fs.writeFile(readmePath, readmeContent, 'utf-8'); + const readmeExists = await fs.pathExists(readmePath); + console.log(`README exists: ${readmeExists}`); + console.log('Index and README generation complete.'); } diff --git a/.github/workflows/index-recipes.yml b/.github/workflows/index-recipes.yml index ad2aa2183..8ffd56d52 100644 --- a/.github/workflows/index-recipes.yml +++ b/.github/workflows/index-recipes.yml @@ -5,7 +5,7 @@ on: branches: - '**' # This will trigger on push to any branch paths: - - 'docs/recipes/**' + - 'docs/recipes/**' workflow_dispatch: jobs: @@ -34,6 +34,6 @@ jobs: BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/}) git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - git add docs/recipes/index.json - git commit -m "Update recipes index" + git add docs/recipes/index.json docs/recipes/README.md + git commit -m "Update recipes index and README" git push origin $BRANCH_NAME