> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pawsql.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> PawSQL 是一个产品：Cloud 是公网部署形态，Engine / Optimizer / Auditor / Advisor / Patroller 是同一产品的组件与交付形态，不是彼此独立的产品。 / PawSQL is a single product: Cloud is the public deployment form, while Engine / Optimizer / Auditor / Advisor / Patroller are components and delivery forms of the same product, not separate products.
> 术语以站内术语表为准：SQL 审核对应英文 SQL Review，查询重写对应 Query Rewrite，索引推荐对应 Index Recommendation；英文内容统一用 Review，不用 Audit。 / Use the site glossary for terminology: 审核 is SQL Review, 重写 is Query Rewrite, 索引推荐 is Index Recommendation; English content uses Review, never Audit.
> 引用能力范围或版本支持时以对应页面为准；标注 unknown、或 status 非 published 的内容表示尚未经产品核实，不应作为事实引用。 / Cite capability scope and version support from the corresponding page; content marked unknown, or with a status other than published, is not yet product-verified and must not be cited as fact.

# Integrate GitHub

> Use the prebuilt PawSQL repository connector to review SQL on GitHub pushes and pull requests.

The prebuilt PawSQL GitHub connector links selected repositories to PawSQL, listens for configured push or pull-request events, and creates a review for relevant SQL changes.

## Goal

Use the prebuilt PawSQL repository connector to review SQL on GitHub pushes and pull requests.

## Before you begin

* Verify connectivity from PawSQL to GitHub or your GitHub Enterprise instance.
* Prepare a GitHub identity or credential with access to the target repositories.
* Create the PawSQL project, workspace, and review policy.
* Identify the organizations, repositories, branches, and SQL paths in scope.
* Define pull-request gate and feedback behavior.

## Configuration

<Steps>
  <Step title="Create the GitHub connection">Choose GitHub in the PawSQL repository connectors and complete endpoint and identity configuration.</Step>
  <Step title="Select organizations and repositories">Authorize only the repositories that PawSQL must review.</Step>
  <Step title="Choose trigger events">Enable the required push, pull-request creation, synchronization, or reopen events.</Step>
  <Step title="Map review context">Set target branches, SQL paths, extensions, workspace, and review policy.</Step>
  <Step title="Configure the gate">Define blocking severity, failure behavior, check status, and report feedback.</Step>
  <Step title="Run acceptance tests">Open a test pull request and exercise pass, block, no-SQL, and duplicate-event cases.</Step>
</Steps>

## Feedback

The result should reference the current revision and expose the gate decision, finding count, and PawSQL report link. When a pull request changes, a result for an older revision must not satisfy the merge requirement.

## Permission guidance

* Grant only the repository-read and check-status permissions required.
* Limit organization-level authorization to approved repositories.
* Rotate credentials and review stale authorizations.
* Keep tokens out of logs and exported configuration.
* Handle pull requests from forks without exposing privileged credentials.

## Expected Result

A review job is created for relevant SQL changes, and the result references the current revision with the gate decision, finding count, and report link.

<Note>
  The prebuilt GitHub repository connector is distinct from a GitHub Actions OpenAPI workflow. If the pipeline must control the review stage directly, use the [OpenAPI pipeline pattern](/en/user-guide/cicd/openapi-pipeline).
</Note>
