Skip to main content
Glama
paulsham

Wiki Analytics Specification MCP Server

by paulsham
transform-wiki.yml7.49 kB
name: Transform Wiki to Specs on: # Automated daily sync (optional - uncomment to enable) # schedule: # # Run once daily at 2 AM UTC # - cron: '0 2 * * *' # Allow manual triggering from GitHub UI workflow_dispatch: inputs: force_transform: description: 'Force transformation even if no wiki changes detected' required: false type: boolean default: false jobs: transform: runs-on: ubuntu-latest permissions: contents: write env: HUSKY: 0 # Disable Husky hooks in CI (bot is allowed to commit specs) steps: # Step 1: Checkout main repo - name: Checkout main repository uses: actions/checkout@v4 with: fetch-depth: 0 # Full history needed for tracking # Step 2: Clone wiki repository - name: Clone wiki repository run: | echo "📚 Cloning wiki repository..." git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git wiki cd wiki echo "Latest wiki commit: $(git rev-parse HEAD)" cd .. # Step 3: Check for wiki changes - name: Check for wiki changes id: check_changes run: | echo "🔍 Checking for wiki changes..." # Get the last processed wiki commit hash if [ -f .last_wiki_commit ]; then LAST_COMMIT=$(cat .last_wiki_commit) echo "Last processed wiki commit: $LAST_COMMIT" else LAST_COMMIT="" echo "No previous wiki commit found (first run)" fi # Get current wiki commit hash cd wiki CURRENT_COMMIT=$(git rev-parse HEAD) cd .. echo "Current wiki commit: $CURRENT_COMMIT" # Check if there are new commits or force flag is set FORCE="${{ inputs.force_transform }}" if [ "$FORCE" = "true" ]; then echo "⚡ Force transformation requested" echo "has_changes=true" >> $GITHUB_OUTPUT echo "current_commit=$CURRENT_COMMIT" >> $GITHUB_OUTPUT echo "reason=forced" >> $GITHUB_OUTPUT elif [ "$LAST_COMMIT" != "$CURRENT_COMMIT" ]; then echo "✅ Wiki has new commits - will transform" echo "has_changes=true" >> $GITHUB_OUTPUT echo "current_commit=$CURRENT_COMMIT" >> $GITHUB_OUTPUT echo "reason=new_commits" >> $GITHUB_OUTPUT else echo "⏭️ No wiki changes detected - skipping transformation" echo "has_changes=false" >> $GITHUB_OUTPUT fi # Step 4: Setup Node.js (only if changes detected) - name: Setup Node.js if: steps.check_changes.outputs.has_changes == 'true' uses: actions/setup-node@v4 with: node-version: '20' cache: 'npm' # Step 5: Install dependencies (only if changes detected) - name: Install dependencies if: steps.check_changes.outputs.has_changes == 'true' run: | echo "📦 Installing dependencies..." npm ci # Step 6: Run transformation (only if changes detected) - name: Build specs from wiki if: steps.check_changes.outputs.has_changes == 'true' run: | echo "🔄 Building specs from wiki..." npm run build echo "✅ Build complete" # Step 7: Check if specs actually changed - name: Check for spec changes if: steps.check_changes.outputs.has_changes == 'true' id: check_spec_changes run: | # Check for both modified tracked files and new untracked files CHANGES=$(git status --porcelain specs/) if [ -z "$CHANGES" ]; then echo "specs_changed=false" >> $GITHUB_OUTPUT echo "ℹ️ No changes to specs (wiki changed but output is identical)" else echo "specs_changed=true" >> $GITHUB_OUTPUT echo "✅ Specs have changed" echo "Changes detected:" echo "$CHANGES" fi # Step 8: Commit and push changes (only if specs changed) - name: Commit and push changes if: steps.check_changes.outputs.has_changes == 'true' && steps.check_spec_changes.outputs.specs_changed == 'true' run: | echo "💾 Committing changes..." # Configure git git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" # Add specs changes only git add specs/ # Create commit message with wiki commit reference WIKI_COMMIT="${{ steps.check_changes.outputs.current_commit }}" LAST_COMMIT=$(cat .last_wiki_commit 2>/dev/null || echo "") # Get wiki commit messages since last sync cd wiki if [ -n "$LAST_COMMIT" ]; then COMMIT_COUNT=$(git rev-list --count $LAST_COMMIT..$WIKI_COMMIT) COMMIT_LIST=$(git log --format="- %h: %s" $LAST_COMMIT..$WIKI_COMMIT) else COMMIT_COUNT=1 COMMIT_LIST=$(git log --format="- %h: %s" -1 $WIKI_COMMIT) fi cd .. # Build commit message if [ "${{ steps.check_changes.outputs.reason }}" = "forced" ]; then COMMIT_MSG="chore(specs): Regenerate from wiki [skip ci]" elif [ "$COMMIT_COUNT" -eq 1 ]; then WIKI_MSG=$(cd wiki && git log --format="%s" -1 $WIKI_COMMIT) COMMIT_MSG="chore(specs): $WIKI_MSG [skip ci]" else COMMIT_MSG="chore(specs): Multiple wiki updates ($COMMIT_COUNT commits) [skip ci]" fi # Commit specs with subject and body git commit -m "$COMMIT_MSG" \ -m "Automatically synced from wiki." \ -m "Recent wiki changes:" \ -m "$COMMIT_LIST" \ -m "Wiki commit: $WIKI_COMMIT" # Push specs commit git push # ONLY after successful push, update the tracking file echo "$WIKI_COMMIT" > .last_wiki_commit git add .last_wiki_commit git commit -m "chore: update wiki sync marker [skip ci]" git push echo "✅ Changes pushed to repository" # Step 9: Summary - name: Workflow summary if: always() run: | echo "## Workflow Summary" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY if [ "${{ steps.check_changes.outputs.has_changes }}" = "true" ]; then echo "✅ **Changes detected and processed**" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "- Wiki commit: \`${{ steps.check_changes.outputs.current_commit }}\`" >> $GITHUB_STEP_SUMMARY echo "- Reason: ${{ steps.check_changes.outputs.reason }}" >> $GITHUB_STEP_SUMMARY if [ "${{ steps.check_spec_changes.outputs.specs_changed }}" = "true" ]; then echo "- Result: Specs updated and committed" >> $GITHUB_STEP_SUMMARY else echo "- Result: No spec changes (transformation produced identical output)" >> $GITHUB_STEP_SUMMARY fi else echo "ℹ️ **No changes detected**" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "Wiki has not been updated since last transformation." >> $GITHUB_STEP_SUMMARY fi

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/paulsham/wiki-mcp-analytics-test-1.1.0'

If you have feedback or need assistance with the MCP directory API, please join our Discord server