Примечание. Формы проблем в настоящее время находятся в бета-версии и подлежат изменению.
Сведения о синтаксисе YAML для форм проблем
Вы можете создать пользовательские формы проблем, добавляя YAML-файлы определения форм в папку /.github/ISSUE_TEMPLATE репозитория. Если вы не знакомы с YAML и хотите узнать о нем подробнее, см. раздел Узнайте о YAML за Y минут. Для форм проблем можно определять различные типы входных данных, проверки, уполномоченных по умолчанию и метки по умолчанию.
Когда участник заполняет форму проблемы, его ответы преобразуются в markdown и добавляются в текст проблемы. Участники могут изменять свои проблемы, созданные с помощью форм проблем, а другие пользователи могут взаимодействовать с такими проблемами так же, как с созданными другими способами.
Формы проблем не поддерживаются для запросов на вытягивание. Вы можете создавать шаблоны запросов на вытягивание в репозиториях для использования участниками совместной работы. Дополнительные сведения см. в разделе Создание шаблона запроса на вытягивание для репозитория.
В этом примере файл конфигурации YAML определяет форму проблемы для сообщения об ошибке с использованием нескольких входных полей.
Примечание. 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
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
Общий синтаксис
Все файлы конфигурации для форм проблем должны начинаться с пар "ключ-значение" name, description и body.
name: description: body:
name:
description:
body:
Для каждой формы проблемы можно задать следующие ключи верхнего уровня.
| Ключ. | Description | Обязательное поле | Тип |
|---|---|---|---|
name | Имя шаблона формы проблемы. Должно отличаться от имен остальных шаблонов, включая шаблоны Markdown. | Обязательное поле | Строка |
description | Описание шаблона формы проблемы, которое отображается в интерфейсе выбора шаблона. | Обязательное поле | Строка |
body | Определение типов входных данных в форме. | Обязательное поле | Массив |
assignees | Пользователи, которые будут автоматически назначены проблемам, созданным с помощью этого шаблона. | Необязательно | Массив или строка с разделителями-запятыми |
labels | Метки, которые будут автоматически добавляться к проблемам, созданным с помощью этого шаблона. Если метка еще не существует в репозитории, она не будет автоматически добавлена в проблему. | Необязательно | Массив или строка с разделителями-запятыми |
title | Заголовок по умолчанию, который будет предварительно заполнен в форме отправки проблемы. | Необязательно | Строка |
Доступные body типы входных данных и их синтаксис см. в разделе "Синтаксис для схемы формы GitHub".
Преобразование шаблона проблемы Markdown в шаблон формы проблемы YAML
В репозитории можно использовать шаблоны проблем Markdown и YAML. Если вы хотите преобразовать шаблон проблемы Markdown в шаблон формы проблемы YAML, необходимо создать файл YAML для определения формы проблемы. Вы можете вручную транспонировать существующий шаблон проблемы Markdown в форму проблемы YAML. Дополнительные сведения см. в разделе Настройка шаблонов проблем для репозитория.
Если вы хотите использовать то же имя файла для формы проблемы YAML, при фиксации нового файла в репозитории необходимо удалить шаблон проблемы Markdown.
Ниже приведен пример шаблона проблемы Markdown и соответствующего шаблона формы проблемы YAML.
Шаблон проблемы Markdown
--- 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... 1. With this config... 1. Run '...' 1. 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! -->
---
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...
1. With this config...
1. Run '...'
1. 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
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...
1. With this config...
1. Run '...'
1. 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
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...
1. With this config...
1. Run '...'
1. 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