name: Agent QA Runtime

on:
  workflow_dispatch:
  schedule:
    - cron: '17 */6 * * *'

jobs:
  readonly-runtime:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run bounded public endpoint checks
        run: |
          curl --fail --show-error --silent \
            -H 'Content-Type: application/json' \
            --data-binary @.github/agent-qa-runtime.json \
            https://agentmediatools.com/api/agent-qa/runtime \
            > agent-qa-runtime-result.json
          node -e "const r=require('./agent-qa-runtime-result.json'); console.log(JSON.stringify(r, null, 2)); process.exit(r.gate.passed ? 0 : 1)"
      - name: Upload runtime report
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: agent-qa-runtime-report
          path: agent-qa-runtime-result.json
