> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/pr-torirsunogtingu/bitbucket-pr-gating/bitbucket-ci-pr-gating-via-aikido-dashboard-with-a-workspace-access-token.md).

# Bitbucket Premium: PR ゲーティングの設定

{% hint style="warning" %}
この設定は次の用途向けです **Bitbucket Premium**.

次を介して認証したい場合に使用します： **Workspace Access Token**。また、マージ前の必須チェック（PRゲーティング）もサポートします。

もしあなたが **Bitbucket Free または Standard**の場合は、 [**ユーザーベースの設定**](/docs/docs-ja/pr-torirsunogtingu/bitbucket-pr-gating/bitbucket-ci-pr-gating-via-aikido-dashboard.md) を代わりに使用してください。
{% endhint %}

## Bitbucket PR スキャンを設定する <a href="#setting-up-bitbucket-ci" id="setting-up-bitbucket-ci"></a>

{% stepper %}
{% step %}
**Workspace Access Token を作成する**

Bitbucket で次へ移動します： `Workspace settings > Access tokens`.

選択 **アクセス トークンを作成**.

<div data-with-frame="true"><figure><img src="/files/26e4da2274e2284498add1033c4a9313866fc7f5" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**適切なアクセス権を付与する**

トークンに名前を付けます（例： `AikidoSec`）。ローテーション ポリシーに合った有効期限を設定します。

次のスコープを有効にします：

* **リポジトリ:** 読み取りと書き込み
* **プルリクエスト:** 読み取りと書き込み
* **Webhooks:** 読み取りと書き込み
* **Pipelines:** 読み取りと書き込み

<div data-with-frame="true"><figure><img src="/files/078c25966dde093e36da7da03d1af8c42fbd65a8" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**アクセス トークンをコピーする**

生成されたトークンをコピーします。手順5に貼り付けてください。

トークンは一度しか表示されません。後から取得することはできません。

<div data-with-frame="true"><figure><img src="/files/f6ade0a4ff9fcd2beaba12593756a32e68967367" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**連携を有効にする**

Aikido で [統合](https://app.aikido.dev/settings/integrations?section=ci) ページを開きます。次に、 **Bitbucket** の下で **PR Quality Gating**.

<div data-with-frame="true"><figure><img src="/files/83a768e5d51061ffaed2670560d6a292ea609192" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Aikido にトークンを追加する**

Aikido に Workspace Access Token を貼り付けます。Aikido がトークンとその権限を検証します。

<div data-with-frame="true"><figure><img src="/files/23513c03b6e5c7dc85ad7c7ce81f5973ff61614b" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**最初のリポジトリを設定する**

認証後、Aikido は [Bitbucket PR Checks](https://app.aikido.dev/settings/integrations/bitbucket/checks) ページ。

まずは **1つのリポジトリから** 始めてください。広く展開する前に、すべてが正常に動作することを確認します。

<div data-with-frame="true"><figure><img src="/files/93d494465db67ef7f0916da4d3afbf99d4139cb2" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**新しい PR で確認する**

設定したリポジトリで新しい PR を開きます。次に、チェックが実行されることを確認します。

<div data-with-frame="true"><figure><img src="/files/a2cab4bc67c5b37010a514fe08bee6a217691726" alt=""><figcaption></figcaption></figure></div>

コメントとチェックの更新は、Workspace Access Token の識別子として表示されるはずです（例： `AikidoSec`).

<figure><img src="/files/94f5cc663939283c290fcf3ec8306bf4f7fefc35" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**スキャンをマージチェックとして必須にする**

スキャンが成功するまでマージをブロックしたい場合は、 **必須チェック** を Bitbucket で設定します。

Bitbucket で次へ移動します： `Repository settings > Workflow > Branch restrictions`。対象ブランチの制限を追加または更新します（例： `main`).

Atlassian リファレンス： [マージ前にチェックを提案または必須にする](https://support.atlassian.com/bitbucket-cloud/docs/suggest-or-require-checks-before-a-merge/).
{% endstep %}

{% step %}
**すべてのリポジトリで有効にする**

結果に満足したら、 [Bitbucket PR Checks](https://app.aikido.dev/settings/integrations/bitbucket/checks) ページに戻って、残りのリポジトリでチェックを有効にします。

<div data-with-frame="true"><figure><img src="/files/e9fd8417e243fe3bb74d2a0ed8d29eabe5ce9541" alt=""><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**新しいリポジトリのデフォルトを設定する**

右上で、 `アクション` を選択します `Set Default for New Repos`.

参照： [新しいリポジトリ向けのデフォルト PR/MR ゲーティング設定](/docs/docs-ja/pr-torirsunogtingu/aikido-ci-gating-functionality/default-pr-mr-gating-configuration-for-new-repositories.md) UI ガイダンスはこちら。
{% endstep %}
{% endstepper %}


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/docs/docs-ja/pr-torirsunogtingu/bitbucket-pr-gating/bitbucket-ci-pr-gating-via-aikido-dashboard-with-a-workspace-access-token.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
