#!/bin/bash # PR Validation Script # This script runs all necessary checks before merging a PR set -e echo "๐Ÿ” Starting PR validation..." # Check if Node.js is installed if ! command -v node &> /dev/null; then echo "โŒ Node.js is not installed" exit 1 fi echo "๐Ÿ“ฆ Installing dependencies..." npm ci echo "๐Ÿ”จ Building project..." npm run build echo "๐Ÿงช Running unit tests..." npm run test:unit echo "โœจ Checking code formatting..." npm run format:check || { echo "โš ๏ธ Code formatting issues found. Run 'npm run format' to fix." exit 1 } echo "๐Ÿ” Running linter..." npm run lint || { echo "โš ๏ธ Linting issues found. Run 'npm run lint:fix' to fix." exit 1 } echo "๐Ÿ“Š Running tests with coverage..." npm run test:coverage # Check if integration tests should run if [ -n "$GITLAB_TOKEN" ] && [ -n "$TEST_PROJECT_ID" ]; then echo "๐ŸŒ Running integration tests..." npm run test:integration else echo "โš ๏ธ Skipping integration tests (no credentials provided)" fi echo "๐Ÿณ Testing Docker build..." if command -v docker &> /dev/null; then docker build -t mcp-gitlab-test . echo "โœ… Docker build successful" else echo "โš ๏ธ Docker not available, skipping Docker build test" fi echo "โœ… All PR validation checks passed!"