> 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`）。ローテーションポリシーに合った有効期限を設定します。

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

* **Repositories:** 読み取りと書き込み
* **Pull Requests:** 読み取りと書き込み
* **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 のIDとして表示されるはずです（例： `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.
