diff --git a/.github/workflows/openapi-spec-review.yaml b/.github/workflows/openapi-spec-review.yaml new file mode 100644 index 0000000000..71a1b32f1c --- /dev/null +++ b/.github/workflows/openapi-spec-review.yaml @@ -0,0 +1,45 @@ +name: OpenAPI spec review + +on: + pull_request: + types: [opened, synchronize] + paths: + - 'apify-api/openapi/**' + +permissions: + contents: read + +jobs: + trigger-review: + name: Trigger agent review + runs-on: ubuntu-latest + # Secrets are not available to PRs from forks + if: github.event.pull_request.head.repo.full_name == github.repository + + steps: + - name: Start review session + env: + ANTHROPIC_API_KEY: ${{ secrets.OPENAPI_SPEC_CHECKER_KEY }} + PR_URL: ${{ github.event.pull_request.html_url }} + PR_NUMBER: ${{ github.event.pull_request.number }} + run: | + jq -n --arg pr_url "$PR_URL" --arg pr_number "$PR_NUMBER" '{ + agent: "agent_0174zMwq9qzt879TvNydsk7U", + environment_id: "env_01GHCycXuDrfD7iMFZFie9fD", + vault_ids: ["vlt_011CgBEg4og89Ai1ea6rFSiL"], + title: "PR #\($pr_number)", + initial_events: [ + { + type: "user.message", + content: [ + { type: "text", text: "Review this pull request: \($pr_url)" } + ] + } + ] + }' | curl -sS --fail-with-body https://api.anthropic.com/v1/sessions \ + -H "Content-Type: application/json" \ + -H "anthropic-version: 2023-06-01" \ + -H "anthropic-beta: managed-agents-2026-04-01" \ + -H "anthropic-workspace-id: wrkspc_01WgY7dQqUQz8iqpLXhjt8Ho" \ + -H "x-api-key: $ANTHROPIC_API_KEY" \ + -d @-