Skip to content

AI Skill Maintenance #26

AI Skill Maintenance

AI Skill Maintenance #26

name: AI Skill Maintenance
on:
workflow_dispatch:
inputs:
dry_run:
description: "Dry run (don't write files)"
type: boolean
default: false
force:
description: "Force run even if no changes detected"
type: boolean
default: false
schedule:
- cron: "17 5 * * 1" # Mondays at 5:17 AM UTC (after upstream-sync)
repository_dispatch:
types: [upstream-release]
jobs:
# Step 1: Refresh upstream indices first
refresh-indices:
runs-on: ubuntu-latest
outputs:
has_index_changes: ${{ steps.check.outputs.has_changes }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Update upstream indices
run: node shared/scripts/update-upstream-indices.mjs
- name: Check for index changes
id: check
run: |
if git diff --quiet shared/references/; then
echo "has_changes=false" >> $GITHUB_OUTPUT
echo "No index changes detected"
else
echo "has_changes=true" >> $GITHUB_OUTPUT
echo "Index changes detected:"
git diff --stat shared/references/
fi
- name: Commit index updates
if: steps.check.outputs.has_changes == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add shared/references/
git commit -m "chore: update upstream indices"
- name: Upload workspace
uses: actions/upload-artifact@v4
with:
name: workspace-with-indices
path: .
retention-days: 1
# Step 2: Run AI analysis and generate updates
generate-updates:
needs: refresh-indices
if: needs.refresh-indices.outputs.has_index_changes == 'true' || github.event.inputs.force == 'true'
runs-on: ubuntu-latest
outputs:
has_skill_updates: ${{ steps.generate.outputs.has_updates }}
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: workspace-with-indices
path: .
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install @anthropic-ai/sdk
- name: Generate skill updates
id: generate
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
AI_DRY_RUN: ${{ github.event.inputs.dry_run }}
run: |
node shared/scripts/ai-generate-updates.mjs
# Check if any skill files changed
if git diff --quiet skills/; then
echo "has_updates=false" >> $GITHUB_OUTPUT
else
echo "has_updates=true" >> $GITHUB_OUTPUT
fi
- name: Upload workspace with updates
uses: actions/upload-artifact@v4
with:
name: workspace-with-updates
path: .
retention-days: 1
# Step 3: Validate and create PR
create-pr:
needs: generate-updates
if: needs.generate-updates.outputs.has_skill_updates == 'true'
runs-on: ubuntu-latest
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: workspace-with-updates
path: .
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Run validation
run: node eval/harness/run.mjs
- name: Read update summary
id: summary
run: |
if [ -f ".github/state/update-summary.json" ]; then
SUMMARY=$(cat .github/state/update-summary.json | jq -r '.updates | map("- **\(.skill)**: \(.summary)") | join("\n")')
echo "summary<<EOF" >> $GITHUB_OUTPUT
echo "$SUMMARY" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
else
echo "summary=No summary available" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: AI-generated skill updates"
title: "🤖 AI-generated skill updates"
body: |
## Summary
This PR contains AI-generated updates to skills based on upstream changes.
### Changes
${{ steps.summary.outputs.summary }}
### Review Checklist
- [ ] Verify changes align with upstream documentation
- [ ] Check that procedures are still accurate
- [ ] Run eval scenarios manually if needed
- [ ] Confirm no breaking changes to skill format
---
🤖 Generated by [AI Skill Maintenance](.github/workflows/ai-skill-maintenance.yml)
<details>
<summary>Trigger info</summary>
- Workflow run: ${{ github.run_id }}
- Triggered by: ${{ github.event_name }}
- Force run: ${{ github.event.inputs.force || 'false' }}
</details>
branch: ai/skill-updates-${{ github.run_number }}
delete-branch: true
labels: |
ai-generated
needs-review
# Fallback: Create PR with just index updates if no skill changes
create-index-pr:
needs: [refresh-indices, generate-updates]
if: |
always() &&
needs.refresh-indices.outputs.has_index_changes == 'true' &&
(needs.generate-updates.result == 'skipped' || needs.generate-updates.outputs.has_skill_updates == 'false')
runs-on: ubuntu-latest
steps:
- name: Download workspace
uses: actions/download-artifact@v4
with:
name: workspace-with-indices
path: .
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: refresh upstream indices"
title: "chore: refresh upstream indices"
body: |
Automated refresh of upstream indices under `shared/references/`.
- WordPress core versions
- Gutenberg releases
- WordPress ↔ Gutenberg mapping
No skill updates were generated (AI analysis determined no changes needed).
branch: chore/upstream-indices
delete-branch: true