@@ -103,7 +103,8 @@ jobs:
103103 test-typescript :
104104 runs-on : ubuntu-latest
105105 name : Test TypeScript Library
106- needs : generate-and-test-schema
106+ needs : [generate-and-test-schema, ai-sync-typescript]
107+ if : always() && needs.generate-and-test-schema.result == 'success'
107108
108109 steps :
109110 - uses : actions/checkout@v4
@@ -239,6 +240,55 @@ jobs:
239240 path : change-detection-results/results.txt
240241 retention-days : 1
241242
243+ ai-sync-typescript :
244+ runs-on : ubuntu-latest
245+ name : AI Sync TypeScript (if significant changes)
246+ needs : [check-python-changes, generate-and-test-schema]
247+ if : needs.check-python-changes.outputs.changes_significant == 'true'
248+
249+ steps :
250+ - uses : actions/checkout@v4
251+ with :
252+ token : ${{ secrets.GITHUB_TOKEN }}
253+ fetch-depth : 2
254+
255+ - name : Set up Python
256+ uses : actions/setup-python@v5
257+ with :
258+ python-version : ' 3.11'
259+
260+ - name : AI Generate TypeScript Updates
261+ env :
262+ CLAUDE_API_KEY : ${{ secrets.CLAUDE_AUTO_SYNC_KEY }}
263+ AI_SYNC_ENABLED : ${{ secrets.AI_SYNC_ENABLED || 'true' }}
264+ run : |
265+ if [[ "$AI_SYNC_ENABLED" != "true" ]]; then
266+ echo "🚫 AI sync disabled via AI_SYNC_ENABLED secret"
267+ exit 0
268+ fi
269+
270+ if [[ -z "$CLAUDE_API_KEY" ]]; then
271+ echo "❌ CLAUDE_AUTO_SYNC_KEY not found - skipping AI generation"
272+ echo "💡 Add Claude API key as CLAUDE_AUTO_SYNC_KEY secret to enable"
273+ exit 0
274+ fi
275+
276+ echo "🤖 Running AI TypeScript generation..."
277+ pip install httpx
278+ python scripts/ai_generate_typescript.py
279+
280+ - name : Commit AI updates
281+ run : |
282+ if [[ -n $(git status --porcelain) ]]; then
283+ git config --local user.email "action@github.com"
284+ git config --local user.name "GitHub Action AI"
285+ git add typescript/src/
286+ git commit -m "🤖 AI auto-sync: Update TypeScript implementation - ${{ needs.check-python-changes.outputs.files_changed }} files, ${{ needs.check-python-changes.outputs.lines_changed }} lines changed"
287+ echo "✅ AI updates committed"
288+ else
289+ echo "ℹ️ No TypeScript changes generated"
290+ fi
291+
242292 integration-test :
243293 runs-on : ubuntu-latest
244294 name : Integration Tests
0 commit comments