feat: add @electric-sql/playbook package with AI coding assistant skills #6
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: Skill Staleness Check | |
| on: | |
| pull_request: | |
| paths: | |
| # Source files that skills reference | |
| - 'AGENTS.md' | |
| - 'website/docs/**/*.md' | |
| - 'packages/typescript-client/src/**/*.ts' | |
| # The skills themselves | |
| - 'packages/agent/skills/**/*.md' | |
| - 'packages/typescript-client/skills/**/*.md' | |
| jobs: | |
| check-staleness: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Get changed files | |
| id: changed-files | |
| run: | | |
| # Get the list of changed files | |
| git diff --name-only origin/${{ github.base_ref }}...HEAD > changed-files.txt | |
| echo "Changed files:" | |
| cat changed-files.txt | |
| - name: Check skill staleness | |
| id: staleness | |
| continue-on-error: true | |
| run: | | |
| exit_code=0 | |
| node scripts/check-skill-staleness.mjs changed-files.txt > staleness-report.txt 2>&1 || exit_code=$? | |
| echo "exit_code=$exit_code" >> $GITHUB_OUTPUT | |
| - name: Comment on PR | |
| if: steps.staleness.outputs.exit_code == '1' | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const report = fs.readFileSync('staleness-report.txt', 'utf8'); | |
| // Check if we already commented | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const botComment = comments.find(c => | |
| c.user.type === 'Bot' && | |
| c.body.includes('Skills potentially affected by this PR') | |
| ); | |
| const body = `🤖 **Agent Skills Staleness Check**\n\n${report}`; | |
| if (botComment) { | |
| // Update existing comment | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: botComment.id, | |
| body, | |
| }); | |
| } else { | |
| // Create new comment | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body, | |
| }); | |
| } |