Сведения о синтаксисе YAML для форм категорий обсуждений
Вы можете создать настраиваемые формы категорий обсуждений, добавив файл определения формы YAML в папку /.github/DISCUSSION_TEMPLATE/ в репозитории. Если вы не знакомы с YAML и хотите узнать больше, ознакомьтесь с разделом "Сведения о YAML" в минутах Y.
Для каждого поля можно определить входной тип, проверку и метку по умолчанию.
Когда член сообщества заполняет форму обсуждения, их ответы для каждого ввода преобразуются в markdown и добавляются в текст обсуждения. Участники сообщества могут изменять свои обсуждения, созданные с помощью формы обсуждения, и другие пользователи могут взаимодействовать с обсуждением, как обсуждение, созданное с помощью других методов.
В этом примере файл конфигурации YAML определяет форму категории общего обсуждения.
title: "[General] "
labels: ["General Introduction"]
body:
- type: markdown
attributes:
value: |
This is text that will show up in the template!
- type: textarea
id: improvements
attributes:
label: Top 3 improvements
description: "What are the top 3 improvements we could make to this project?"
value: |
1.
2.
3.
...
render: bash
validations:
required: true
- type: markdown
attributes:
value: |
## Markdown header
And some more markdown
- type: input
id: has-id
attributes:
label: Suggestions
description: A description about suggestions to help you
validations:
required: true
- type: dropdown
id: download
attributes:
label: Which area of this project could be most improved?
options:
- Documentation
- Pull request review time
- Bug fix time
- Release cadence
validations:
required: true
- type: checkboxes
attributes:
label: Check that box!
options:
- label: This one!
required: true
- label: I won't stop you if you check this one, too
- type: markdown
attributes:
value: |
### The thrilling conclusion
_to our template_
title: "[General] "
labels: ["General Introduction"]
body:
- type: markdown
attributes:
value: |
This is text that will show up in the template!
- type: textarea
id: improvements
attributes:
label: Top 3 improvements
description: "What are the top 3 improvements we could make to this project?"
value: |
1.
2.
3.
...
render: bash
validations:
required: true
- type: markdown
attributes:
value: |
## Markdown header
And some more markdown
- type: input
id: has-id
attributes:
label: Suggestions
description: A description about suggestions to help you
validations:
required: true
- type: dropdown
id: download
attributes:
label: Which area of this project could be most improved?
options:
- Documentation
- Pull request review time
- Bug fix time
- Release cadence
validations:
required: true
- type: checkboxes
attributes:
label: Check that box!
options:
- label: This one!
required: true
- label: I won't stop you if you check this one, too
- type: markdown
attributes:
value: |
### The thrilling conclusion
_to our template_
Общий синтаксис
Файл конфигурации для формы категории обсуждения должен содержать body ключ, и body должно содержать не менее 1 поля, отличного от Markdown.
body:
- type: input
id: suggestion
attributes:
label: Suggestion
description: "How might we make this project better?"
placeholder: "Adding a CODE_OF_CONDUCT.md file would be a great idea."
validations:
required: true
body:
- type: input
id: suggestion
attributes:
label: Suggestion
description: "How might we make this project better?"
placeholder: "Adding a CODE_OF_CONDUCT.md file would be a great idea."
validations:
required: true
Для каждой формы категории обсуждения можно задать следующие ключи верхнего уровня.
| Ключ. | Description | Обязательное поле | Тип |
|---|---|---|---|
body | Определение типов входных данных в форме обсуждения. | Обязательное поле | Массив |
labels | Метки, которые будут автоматически добавлены в обсуждения, созданные с помощью этого шаблона. | Необязательно | Массив или строка с разделителями-запятыми |
title | Заголовок по умолчанию, который будет заполнен в форме отправки обсуждения. | Необязательно | Строка |
Чтобы добавить поля в форму, добавьте массив элементов формы в body ключ. Список доступных элементов и их синтаксиса см. в разделе Синтаксис для схемы формы GitHub.