Skip to content

Commit

Permalink
add readme and index
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Jun 6, 2024
1 parent 34252a0 commit 0577997
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions .github/scripts/generate-index-recipes.js
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -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');
Expand Down Expand Up @@ -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.');
}

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/index-recipes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- '**' # This will trigger on push to any branch
paths:
- 'docs/recipes/**'
- 'docs/recipes/**'
workflow_dispatch:

jobs:
Expand Down Expand Up @@ -34,6 +34,6 @@ jobs:
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})
git config --local user.email "[email protected]"
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

0 comments on commit 0577997

Please sign in to comment.