> For the complete documentation index, see [llms.txt](https://gitbook.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gitbook.com/docs/documentation/ja-gitbook-documentation/docs-as-code/git-sync/github-pull-request-preview.md).

# GitHub のプルリクエストプレビュー

GitHub でプルリクエストを作成する際に、コンテンツのプレビューを確認できます

GitBook セクションに同期されている GitHub ブランチにプルリクエスト（PR）を送信すると、マージする前にコンテンツをプレビューできます。これにより、変更をマージする前にその影響を確認できます。

この機能を使うと、PR をマージする前の最終確認として、同期先のブランチに変更をマージする前に、本番環境以外の環境で変更内容を確認できます。

### プレビューリンクにアクセスする方法

この機能は、 [GitBook GitHub アプリ](https://github.com/apps/gitbook-com) に PR への読み取り専用アクセス権を付与していれば、追加の設定なしで利用できます。

GitBook セクションに同期されているターゲットブランチを使って PR を作成すると、固有のプレビュー URL を含むステータスが PR に追加されます。ステータスの **詳細** リンクをクリックすると、コンテンツのプレビュー URL に移動します。PR をマージする前に、コンテンツが期待どおりであることを確認できます。

{% hint style="info" %}
プレビューリンクにアクセスできるのは、GitBook アカウントを持つユーザーのみです。
{% endhint %}

### セキュリティに関する考慮事項

セキュリティ上の理由から、デフォルトでは、リポジトリのフォークから作成された PR のプレビューは現在生成されません。PR のプレビューコンテンツは、独自のドメイン（ `.gitbook.io` またはカスタムドメイン）でアクセス可能なため、ユーザーが公開リポジトリのフォーク内に悪意のあるコンテンツを作成し、それをあなたの名前で配信させる可能性があります。

Git Sync の設定にあるオプションを使って、この動作を明示的に設定できます。

### FAQ

#### プルリクエストで GitBook ドキュメントのプレビューを表示できないのはなぜですか？

よくある原因：

* **サイトが公開されていません。** PR のプレビュー URL は、公開済みのドキュメントサイト（ `.gitbook.io` またはカスタムドメイン）から配信されます。
* **サイトが認証付きアクセスの背後にあります。** 認証付きアクセスの背後で公開されているサイトでは、Git Sync の PR プレビューを利用できません。 [認証付きアクセス](https://gitbook.com/docs/documentation/ja-gitbook-documentation/publish/site-audience/authenticated-access.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gitbook.com/docs/documentation/ja-gitbook-documentation/docs-as-code/git-sync/github-pull-request-preview.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
