注: 現在、Issue フォームは、GitHub.com のベータ版のみです。
Issue フォームの YAML 構文について
YAML フォーム定義ファイルをリポジトリの /.github/ISSUE_TEMPLATE
フォルダに追加することで、カスタム Issue フォームを作成できます。 YAML を初めて使用する場合は、「Learn YAML in Y minutes」 (YAML を Y 分で学習する) を参照してください。 Issue フォームにさまざまな入力タイプ、検証、デフォルトのアサインされた人、デフォルトのラベルを定義できます。
コントリビューターが Issue フォームに入力すると、それぞれの入力に対する回答が Markdown に変換され、Issue の本文に追加されます。 コントリビューターは、Issue フォームで作成された問題を編集でき、他のユーザは、他の方法で作成された Issue のように Issue を取り扱うことができます。
Issue フォームは、pull request ではサポートされていません。 コラボレーターが使用できるように、リポジトリの pull request テンプレートを作成できます。 詳しくは、「リポジトリ用のプルリクエストテンプレートの作成」を参照してください。
このサンプル YAML 設定ファイルでは、バグを報告するためにいくつかの入力を使用して Issue フォームを定義します。
注: required
フィールド キーは、パブリック リポジトリ内でのみサポートされます。 プライベート リポジトリと内部リポジトリでは、フィールドはすべて省略可能です。
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug", "triage"]
assignees:
- octocat
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: input
id: contact
attributes:
label: Contact Details
description: How can we get in touch with you if we need more info?
placeholder: ex. email@example.com
validations:
required: false
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Also tell us, what did you expect to happen?
placeholder: Tell us what you see!
value: "A bug happened!"
validations:
required: true
- type: dropdown
id: version
attributes:
label: Version
description: What version of our software are you running?
options:
- 1.0.2 (Default)
- 1.0.3 (Edge)
validations:
required: true
- type: dropdown
id: browsers
attributes:
label: What browsers are you seeing the problem on?
multiple: true
options:
- Firefox
- Chrome
- Safari
- Microsoft Edge
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: checkboxes
id: terms
attributes:
label: Code of Conduct
description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com)
options:
- label: I agree to follow this project's Code of Conduct
required: true
最上位の構文
すべての Issue フォーム構成ファイルは、name
、description
、および body
のキー/値ペアで始まる必要があります。
name:
description:
body:
各 Issue フォームに次の最上位のキーを設定できます。
Key | 説明 | 必須 | 型 | |
---|---|---|---|---|
name | Issue フォームテンプレートの名前。 Markdown テンプレートを含む他のすべてのテンプレートと異なる、一意の名前である必要があります。 | 必須 | String | |
description | テンプレート選択インターフェイスに表示される、Issue フォーム テンプレートの説明。 | 必須 | String | |
body | フォームでの入力の種類の定義。 | 必須 | Array | |
assignees | このテンプレートで作成された Issue に自動的に割り当てられるユーザー。 | オプション | 配列またはコンマ区切りの文字列 | |
labels | このテンプレートで作成された Issue に自動的に追加されるラベル。 リポジトリにラベルがまだ存在しない場合、それが自動的に Issue に追加されることはありません。 | オプション | 配列またはコンマ区切りの文字列 | |
title | Issue 送信フォームに事前に設定されるデフォルトのタイトル。 | オプション | String |
body
で使用できる入力の種類とその構文については、「GitHub のフォームスキーマの構文」をご覧ください。
Markdown Issue テンプレートを YAML Issue フォーム テンプレートに変換する
リポジトリ内では、Markdown と YAML の両方の Issue テンプレートを使用できます。 Markdown Issue テンプレートを YAML Issue フォーム テンプレートに変換する場合は、新しい YAML ファイルを作成して、Issue フォームを定義する必要があります。 既存の Markdown Issue テンプレートを YAML Issue フォーム テンプレートに変換する場合は、手動で行うことができます。 詳しくは、「リポジトリ用に Issue テンプレートを設定する」を参照してください。
YAML Issue フォームに同じファイル名を使用する場合は、新しいファイルをリポジトリにコミットするときに、Markdown Issue テンプレートを削除する必要があります。
Markdown Issue テンプレートと、対応する YAML Issue フォーム テンプレートの例を次に示します。
Markdown Issue テンプレート
---
name: 🐞 Bug
about: File a bug/issue
title: '[BUG] <title>'
labels: Bug, Needs Triage
assignees: ''
---
<!--
Note: Please search to see if an issue already exists for the bug you encountered.
-->
### Current Behavior:
<!-- A concise description of what you're experiencing. -->
### Expected Behavior:
<!-- A concise description of what you expected to happen. -->
### Steps To Reproduce:
<!--
Example: steps to reproduce the behavior:
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
-->
### Environment:
<!--
Example:
- OS: Ubuntu 20.04
- Node: 13.14.0
- npm: 7.6.3
-->
### Anything else:
<!--
Links? References? Anything that will give us more context about the issue that you are encountering!
-->
YAML Issue フォーム テンプレート
name: 🐞 Bug
description: File a bug/issue
title: "[BUG] <title>"
labels: [Bug, Needs Triage]
body:
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Current Behavior
description: A concise description of what you're experiencing.
validations:
required: false
- type: textarea
attributes:
label: Expected Behavior
description: A concise description of what you expected to happen.
validations:
required: false
- type: textarea
attributes:
label: Steps To Reproduce
description: Steps to reproduce the behavior.
placeholder: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: false
- type: textarea
attributes:
label: Environment
description: |
examples:
- **OS**: Ubuntu 20.04
- **Node**: 13.14.0
- **npm**: 7.6.3
value: |
- OS:
- Node:
- npm:
render: markdown
validations:
required: false
- type: textarea
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false