name: "CI: MCP"

on:
  pull_request:
    branches:
      - develop
      - staging
      - main

    types:
      - opened
      - synchronize
      - ready_for_review

    paths:
      - 'mcp/**'

  push:
    branches:
      - develop
      - staging
      - main

    paths:
      - 'mcp/**'

jobs:
  test-mcp:
    if: ${{ !github.event.pull_request.draft }}
    name: "Test MCP"
    runs-on: penpot-extended-runner
    container: penpotapp/devenv:latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v6

      - name: Setup
        working-directory: ./mcp
        run: ./scripts/setup

      - name: Check
        working-directory: ./mcp
        run: |
          pnpm run fmt:check;
          pnpm -r run build;
          pnpm -r run types:check;

      - name: Tests
        working-directory: ./mcp
        run: |
          pnpm run test;
