Skip to content

Commit fce6eee

Browse files
feat: Add workflow to auto-update MCP package when project data changes
- Created .github/workflows/update-mcp-package.yml - Triggers on pushes/PRs that modify _data/projects/*.yml - Properly checks for changes before committing (avoids empty commits) - Updates MCP package with latest Drupal tools data - Includes detailed summary in GitHub Actions output Key improvements: - Uses git status --porcelain to check for actual changes - Only commits when MCP package data has been updated - Provides clear feedback about what was changed - Includes tool count in commit message 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1164313 commit fce6eee

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Update MCP Package
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
paths:
7+
- '_data/projects/*.yml'
8+
pull_request:
9+
branches: [ main, master ]
10+
paths:
11+
- '_data/projects/*.yml'
12+
workflow_dispatch:
13+
14+
jobs:
15+
update-package:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
with:
24+
token: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '18'
30+
31+
- name: Install dependencies
32+
run: |
33+
cd mcp-package
34+
npm install
35+
36+
- name: Build the MCP package with latest data
37+
run: |
38+
cd mcp-package
39+
npm run build
40+
41+
- name: Run tests
42+
run: |
43+
cd mcp-package
44+
npm test
45+
46+
- name: Check for changes
47+
id: changes
48+
run: |
49+
if [[ -n $(git status --porcelain mcp-package/) ]]; then
50+
echo "has_changes=true" >> $GITHUB_OUTPUT
51+
echo "✅ MCP package data updated"
52+
else
53+
echo "has_changes=false" >> $GITHUB_OUTPUT
54+
echo "ℹ️ No changes to MCP package"
55+
fi
56+
57+
- name: Commit and push changes
58+
if: steps.changes.outputs.has_changes == 'true'
59+
run: |
60+
git config --local user.email "action@github.com"
61+
git config --local user.name "GitHub Action"
62+
git add mcp-package/
63+
git commit -m "chore: Update MCP package with latest Drupal tools data
64+
65+
- Rebuilt projects.json with $(cd mcp-package && node -e "console.log(Object.keys(JSON.parse(require('fs').readFileSync('dist/projects.json', 'utf8'))).length)" tools
66+
- Updated package when _data/projects changed
67+
68+
🤖 Generated with [Claude Code](https://claude.com/claude-code)
69+
70+
Co-Authored-By: Claude <noreply@anthropic.com>"
71+
git push
72+
73+
- name: Create summary
74+
run: |
75+
echo "## MCP Package Update Summary" >> $GITHUB_STEP_SUMMARY
76+
echo "" >> $GITHUB_STEP_SUMMARY
77+
if [[ "${{ steps.changes.outputs.has_changes }}" == "true" ]]; then
78+
echo "✅ MCP package has been updated with the latest tools data" >> $GITHUB_STEP_SUMMARY
79+
echo "" >> $GITHUB_STEP_SUMMARY
80+
echo "The package will include:" >> $GITHUB_STEP_SUMMARY
81+
echo "- Updated projects.json" >> $GITHUB_STEP_SUMMARY
82+
echo "- All 186+ Drupal tools data" >> $GITHUB_STEP_SUMMARY
83+
else
84+
echo "ℹ️ No changes needed - MCP package is already up to date" >> $GITHUB_STEP_SUMMARY
85+
fi

0 commit comments

Comments
 (0)