{
  "name": "HikeWise PR Testing",
  "nodes": [
    {
      "parameters": {
        "path": "hikewise-pr-test",
        "options": {}
      },
      "id": "webhook-trigger",
      "name": "GitHub Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1.1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.body.action }}",
              "operation": "equals",
              "value2": "opened"
            }
          ]
        }
      },
      "id": "check-action",
      "name": "Is PR Opened?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "command": "=cd /Users/jackenholland/AppDev/thetriage && python execution/maestro_test_runner.py --action run --flows .maestro/flows/verify"
      },
      "id": "run-tests",
      "name": "Run Maestro Tests",
      "type": "n8n-nodes-base.executeCommand",
      "typeVersion": 1,
      "position": [
        650,
        200
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://api.github.com/repos/{{ $json.body.repository.full_name }}/issues/{{ $json.body.number }}/comments",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "body",
              "value": "=## Automated Test Results\n\n{{ $('Run Maestro Tests').item.json.stdout }}"
            }
          ]
        },
        "options": {}
      },
      "id": "post-comment",
      "name": "Post PR Comment",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        850,
        200
      ]
    }
  ],
  "connections": {
    "GitHub Webhook": {
      "main": [
        [
          {
            "node": "Is PR Opened?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is PR Opened?": {
      "main": [
        [
          {
            "node": "Run Maestro Tests",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    },
    "Run Maestro Tests": {
      "main": [
        [
          {
            "node": "Post PR Comment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "tags": [
    "hikewise",
    "testing",
    "github"
  ]
}