> 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/autofix-to/configure/linking-tasks-and-prs.md).

# タスクとPRをリンクする

## ユースケース

* PRを自動リンクして、タスクトラッカーでセキュリティ修正の可視性を向上させます。
* 各自動修正PRが正しいタスクに関連付けられていることを確認します。
* PRとタスク間のクリック可能な参照を有効にする

## それは何ですか？

タスクトラッカーを未解決のPull Requestと同期させるために、AutoFixは作成するPull Requestをタスクトラッカー内のタスクにリンクできます。AutoFixにはこれを実現する2つの仕組みがあります：

1. 課題のために作成されたタスクをPull Requestにリンクする
2. 開かれた各Pull Requestごとに新しいタスクを作成する

1の場合、次を設定する必要があります [自動タスク作成](https://help.aikido.dev/getting-started/task-management-systems) を課題に対して。2の場合、次を有効にする必要があります `PR 用タスクを作成` を [AutoFix PR構成](/docs/docs-ja/autofix-to/configure/autofix-pr-configuration.md). ワークフローに応じて、1および/または2を有効にできます。

タスク参照プレースホルダー（`$TASK_REF` ）は次の [プルリクエスト設定](/docs/docs-ja/autofix-to/configure/autofix-pr-configuration.md#pull-request-configuration) フィールドで使用できます：ブランチプレフィックス、コミットメッセージ、PRタイトル。

次の `$TASK_REF` は、PRで解決された課題にリンクされたタスクと、PRのために作成された新しいタスクで埋められます。もし `PR 用タスクを作成` そのオプションが有効な場合。

## 開かれた各Pull Requestごとに新しいタスクを作成する

各AutoFix PRごとにタスクを作成すると、AutoFix PRのレビューとマージを担当する人を割り当てるのに使えます。Enable "*PR 用タスクを作成*"をあなたの [AutoFixの設定](/docs/docs-ja/autofix-to/configure/autofix-pr-configuration.md)。各AutoFix PRごとにタスクが作成されます。既存のタスクにリンクされているかどうかは関係ありません。

対応しているタスクトラッカー：

* Jira
* Jira Datacenter
* Linear
* Asana
* Azure Boards

## 既存のIssueタスクへのPull Requestのリンク

PRで修正された課題のタスク識別子は、既定でブランチ名に含まれます。ワークスペースがタスクトラッカーと統合されている場合、PRはタスクトラッカーによって対応するタスクに自動的にリンクされます。

## JiraとSCMを統合する方法

上記のとおり、AutoFixは `$TASK_REF` をPRに追加できます。ソースコード管理（SCM）プラットフォームとタスクトラッカーの間で連携を設定してください。するとトラッカーがタスク参照を検出し、PRをそのタスクにリンクします。

#### **GitHub → Jira**

**ステップ 1:** インストール [**GitHub for Jira**](https://github.com/marketplace/jira-software-github) をGitHub Marketplaceから。

**ステップ 2:** リンクしたいリポジトリへのアクセス権を付与します。

**ステップ 3:** Jira Cloudでは：

* 次へ移動します： **アプリ → アプリの管理 → GitHub for Jira → 設定**.
* GitHub組織に接続します。

**ステップ 4:** Aikidoでは、 `$TASK_REF` をPRタイトル設定で使用します。

**手順 5：** Jiraチケットキー：

* Jiraでクリック可能なリンクとして表示されます。
* GitHubのUIに表示されます（Jiraで表示するとクリック可能）。

***

#### **GitLab → Jira**

**ステップ 1:** GitLabでは：

* プロジェクト → **設定 → 統合 → Jira**.
* 次を入力します：
  * **Jira URL**: `https://yourcompany.atlassian.net`
  * **ユーザー名**：Atlassianのメールアドレス
  * **パスワード/APIトークン**：Atlassianアカウントから生成

**ステップ 2:** 統合を保存します。

**ステップ 3:** Aikidoでは、 `$TASK_REF` をPRタイトル設定で使用します。

**ステップ 4:** Jiraチケットキー：

* GitLab UIで自動リンク。
* Jiraの開発パネルを更新します。

***

#### **Bitbucket → Jira（Cloud）**

**ステップ 1:** Bitbucket Cloudでは：

* 次へ移動します： **設定 → リンク済みリポジトリ → Jiraプロジェクトをリンク**.
* Atlassianアカウントにサインインし、Jiraプロジェクトを選択します。

**ステップ 2:** Aikidoでは、 `$TASK_REF` をPRタイトル設定で使用します。

**ステップ 3:** Jiraチケットキー：

* Bitbucket UIで自動リンク。
* Jiraの開発情報パネルに表示されます。

***

#### **Azure DevOps → Jira**

**ステップ 1:** 次のようなAzure DevOpsとJiraの間のコネクタをインストールします：

* TFS4JIRA
* [Jira用Git Integration](https://marketplace.atlassian.com/apps/4984/git-integration-for-jira-azure-devops-github-gitlab)
* Exalate

**ステップ 2:** 選択したコネクタで、Azure DevOpsとJiraの両方のアカウントを承認します。

**ステップ 3:** チケットパターンを認識するようにコネクタを設定します（例： `ABC-\d+`).

**ステップ 4:** Aikidoでは、 `$TASK_REF` をPRタイトル設定で使用します。

**手順 5：** Jiraチケットキー：

* PRをJiraにリンクし、Jiraの開発パネルに表示されます。

## タスクを閉じる

Aikidoは、課題が解決または無視されたときにタスクを自動的に閉じることができます [Jira](https://help.aikido.dev/getting-started/task-management-systems/advanced-functionalities/auto-close-jira-tasks-when-aikido-issues-are-resolved) と [Linear](https://help.aikido.dev/getting-started/task-management-systems/advanced-functionalities/auto-close-linear-tasks-when-aikido-issues-are-resolved)。自動でタスクを閉じるが有効な場合、AutoFixはPRが閉じられたときに、作成したタスクを自動的に閉じます。


---

# 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://help.aikido.dev/docs/docs-ja/autofix-to/configure/linking-tasks-and-prs.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.
