name: 🐍🧪 [Core] Send Message SDK Tests

on:
  pull_request:
    branches:
      - main
  pull_request_target:
    branches:
      - main
    types: [labeled]

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
  send-message-tests:
    # Run on pull_request OR on pull_request_target only when labeled "safe to test"
    if: github.event_name == 'pull_request' || (github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'safe to test'))
    uses: ./.github/workflows/reusable-test-workflow.yml
    with:
      test-type: 'send-message'
      is-external-pr: ${{ github.event_name == 'pull_request_target' && !contains(github.event.pull_request.labels.*.name, 'safe to test') }}
      changed-files-pattern: |
        **
        .github/workflows/reusable-test-workflow.yml
        .github/workflows/send-message-integration-tests.yml
      install-args: '--extra dev --extra postgres --extra external-tools --extra cloud-tool-sandbox --extra redis'
      timeout-minutes: 15
      runner: '["self-hosted", "medium"]'
      ref: ${{ github.event.pull_request.head.sha || github.sha }}
      use-redis: true
      # TODO: "azure-gpt-4o-mini.json" add back later, getting content violation
      matrix-strategy: |
        {
          "fail-fast": false,
          "matrix": {
            "config_file": [
              "openai-gpt-4o-mini.json",
              "openai-gpt-4.1.json",
              "openai-gpt-5.json",
              "claude-4-5-sonnet.json",
              "gemini-2.5-pro.json",
            ]
          }
        }
    secrets: inherit
