Merge pull request #41 from thibaultyou/cli/refactoring-commands #169
This file contains hidden or 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 Prompts and Views | |
| on: | |
| push: | |
| paths: | |
| - ".github/workflows/**/*.yml" | |
| - "prompts/**/*.md" | |
| - "prompts/prompt.md" | |
| - "src/**/*.ts" | |
| - "src/system_prompts/**/*.md" | |
| - "src/application/templates/*.md.njk" | |
| 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: Build CLI | |
| run: npm run build | |
| - name: Install CLI globally | |
| run: npm install -g . | |
| - 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: Update metadata files via CLI | |
| env: | |
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | |
| FORCE_REGENERATE: ${{ env.FORCE_REGENERATE }} | |
| run: prompt-library-cli prompt refresh-metadata --all --nonInteractive | |
| - name: Update views via CLI | |
| run: prompt-library-cli generate-docs | |
| - 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/ fragments/ README.md | |
| git status | |
| git diff --staged --name-status | |
| git commit -m "♻️ chore: Update metadata and views [skip ci]" || echo "No changes to commit" | |
| git push |