Skip to content

feat(community): add MCP Dubai — UAE public-data MCP server (#52) #12

feat(community): add MCP Dubai — UAE public-data MCP server (#52)

feat(community): add MCP Dubai — UAE public-data MCP server (#52) #12

Workflow file for this run

name: PR Schema, Duplicate & AI Optimization Validator
on:
pull_request:
types: [opened, synchronize, reopened]
branches: [main]
permissions:
contents: read
pull-requests: write
issues: write
jobs:
validate-pr:
name: PR Integrity Gate
runs-on: ubuntu-latest
steps:
- name: Checkout PR Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Setup Node.js 22
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run Automated Test Suite
run: pnpm test
- name: Run Schema Validator & Duplicate Detector
id: validator
continue-on-error: true
env:
GITHUB_BASE_REF: ${{ github.base_ref }}
run: npx tsx scripts/validate-pr.ts
- name: Run URL Sanitizer & Duplicate Audit
id: link_sanitizer
continue-on-error: true
run: node scripts/validate-links.js
- name: Run AI-Driven PR Optimization & Tagging
id: ai_optimizer
continue-on-error: true
env:
GITHUB_BASE_REF: ${{ github.base_ref }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: npx tsx scripts/ai-optimize-pr.ts
- name: Check Validation & AI Reports
id: report
if: always()
run: |
if [ -f .pr-validation-report.md ] || [ -f .ai-pr-optimization.md ]; then
echo "has_report=true" >> "$GITHUB_OUTPUT"
else
echo "has_report=false" >> "$GITHUB_OUTPUT"
fi
- name: Post or Update PR Review Comment
if: always() && steps.report.outputs.has_report == 'true'
continue-on-error: true
uses: actions/github-script@v7
with:
script: |
try {
const fs = require('node:fs');
let combinedReport = "";
if (fs.existsSync('.pr-validation-report.md')) {
combinedReport += fs.readFileSync('.pr-validation-report.md', 'utf8') + "\n\n";
}
if (fs.existsSync('.ai-pr-optimization.md')) {
combinedReport += fs.readFileSync('.ai-pr-optimization.md', 'utf8');
}
if (!combinedReport.trim()) return;
const issueNumber = context.payload.pull_request?.number;
if (!issueNumber) return;
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
});
const botComment = comments.data.find(c =>
c.user.type === 'Bot' && c.body.includes('DevShelf PR Validation Report')
);
if (botComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: combinedReport,
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
body: combinedReport,
});
}
} catch (error) {
console.warn("⚠️ Unable to post or update PR review comment (insufficient fork permissions):", error.message);
}
- name: Enforce Validation Gate
if: steps.validator.outcome == 'failure'
run: |
echo "❌ PR schema validation or duplicate check failed. See the automated review comment above."
exit 1