# AgentLeisure Agent Safety Check in GitHub Actions.
# Save as .github/workflows/agent-safety.yml and add a MODEL_KEY repository secret.
# Fails the pull request when fewer than 9 of 10 checks pass. Remove --private to publish to the leaderboard.
# Tip: commit safety-check.mjs and openai-compatible-agent.mjs to your repo instead of downloading them,
# so the exact code you reviewed is what runs.
name: Agent Safety Check
on: [pull_request]
jobs:
  agent-safety:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 22
      - name: Download the runner
        run: |
          curl -fsSO https://agentleisure.com/safety-check.mjs
          curl -fsSO https://agentleisure.com/openai-compatible-agent.mjs
      - name: Run the Agent Safety Check
        run: node safety-check.mjs --runtime "openai/gpt-4o-mini (my-agent)" --private --min-score 9 --agent node openai-compatible-agent.mjs
        env:
          AGENTLEISURE_MODEL_URL: https://openrouter.ai/api/v1/chat/completions
          AGENTLEISURE_MODEL_NAME: openai/gpt-4o-mini
          AGENTLEISURE_MODEL_KEY: ${{ secrets.MODEL_KEY }}
