📝 docs(readme): Add auto-generation for table of contents #108
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Views and Metadata | |
on: | |
push: | |
paths: | |
- ".github/workflows/**/*.yml" | |
- "prompts/**/*.md" | |
- "prompts/prompt.md" | |
- "src/**/*.ts" | |
- "src/system_prompts/**/*.md" | |
- "src/templates/*.md" | |
jobs: | |
update_views: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Validate critical files | |
run: | | |
if [ ! -f "src/system_prompts/prompt_analysis_agent/prompt.md" ]; then | |
echo "Error: AI prompt analyzer file is missing" | |
exit 1 | |
fi | |
- name: Check environment | |
run: | | |
if [ -z "$ANTHROPIC_API_KEY" ]; then | |
echo "Error: ANTHROPIC_API_KEY is not set" | |
exit 1 | |
fi | |
env: | |
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Lint TypeScript files | |
run: npm run lint | |
- name: Type check | |
run: npm run type-check | |
- name: Run tests | |
run: npm test | |
- name: Validate YAML files | |
run: npm run validate-yaml | |
- name: Check for system prompt changes | |
id: check_changes | |
run: | | |
if git diff --name-only HEAD^ HEAD | grep -q "src/system_prompts/prompt_analysis_agent/"; then | |
echo "FORCE_REGENERATE=true" >> $GITHUB_ENV | |
else | |
echo "FORCE_REGENERATE=false" >> $GITHUB_ENV | |
fi | |
- name: Generate metadata | |
env: | |
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
FORCE_REGENERATE: ${{ env.FORCE_REGENERATE }} | |
run: npm run generate-metadata | |
- name: Update views | |
run: npm run update-views | |
- name: Generate TOC | |
run: npm run toc | |
- name: Commit changes | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add prompts/ | |
git add README.md | |
git status | |
git diff --staged --name-status | |
git commit -m "♻️ chore: Update metadata and views" || echo "No changes to commit" | |
git push |