Skip to content

Commit 3f602e8

Browse files
sophiethekinggithub-actionslecoursenentcheva
authored
[2022-11-28]: Discussions Category Forms - [Limited Public Beta] (github#32120)
Co-authored-by: github-actions <[email protected]> Co-authored-by: Laura Coursen <[email protected]> Co-authored-by: Christina Entcheva <[email protected]>
1 parent 03a6796 commit 3f602e8

File tree

9 files changed

+158
-1
lines changed

9 files changed

+158
-1
lines changed
104 KB
Loading

content/communities/setting-up-your-project-for-healthy-contributions/creating-a-default-community-health-file.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ You can create defaults in your organization{% ifversion fpt or ghes or ghec %}
3434
Community health file | Description
3535
--- | ---{% ifversion fpt or ghec %}
3636
*CODE_OF_CONDUCT.md* | A CODE_OF_CONDUCT file defines standards for how to engage in a community. For more information, see "[Adding a code of conduct to your project](/articles/adding-a-code-of-conduct-to-your-project/)."{% endif %}
37-
*CONTRIBUTING.md* | A CONTRIBUTING file communicates how people should contribute to your project. For more information, see "[Setting guidelines for repository contributors](/articles/setting-guidelines-for-repository-contributors/)."{% ifversion fpt or ghec %}
37+
*CONTRIBUTING.md* | A CONTRIBUTING file communicates how people should contribute to your project. For more information, see "[Setting guidelines for repository contributors](/articles/setting-guidelines-for-repository-contributors/)."{% ifversion discussion-category-forms %}
38+
Discussion category forms | Discussion category forms customize the templates that are available for community members to use when they open new discussions in your repository. For more information, see "[Creating discussion category forms](/discussions/managing-discussions-for-your-community/creating-discussion-category-forms)."{% endif %}{% ifversion fpt or ghec %}
3839
*FUNDING.yml* | A FUNDING file displays a sponsor button in your repository to increase the visibility of funding options for your open source project. For more information, see "[Displaying a sponsor button in your repository](/articles/displaying-a-sponsor-button-in-your-repository)."{% endif %}
3940
Issue and pull request templates{% ifversion fpt or ghes or ghec %} and *config.yml*{% endif %} | Issue and pull request templates customize and standardize the information you'd like contributors to include when they open issues and pull requests in your repository. For more information, see "[About issue and pull request templates](/articles/about-issue-and-pull-request-templates/)."{% ifversion fpt or ghes or ghec %}
4041
*SECURITY.md* | A SECURITY file gives instructions for how to report a security vulnerability in your project. For more information, see "[Adding a security policy to your repository](/code-security/getting-started/adding-a-security-policy-to-your-repository)."{% endif %}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
title: Creating discussion category forms
3+
shortTitle: Create discussion category forms
4+
intro: 'You can customize the templates that are available for community members to use when they open new discussions in your repository.'
5+
versions:
6+
feature: discussion-category-forms
7+
---
8+
9+
{% data reusables.discussions.discussion-category-forms-beta %}
10+
11+
## About discussion category forms
12+
13+
You can encourage community members to include specific, structured information in their discussions by using discussion forms in your repository. With discussion category forms, you can create discussion templates that have customizable web form fields. Discussion forms are written in YAML using the {% data variables.product.prodname_dotcom %} form schema. For more information, see "[Syntax for {% data variables.product.prodname_dotcom %}'s form schema](/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema)."
14+
15+
{% data reusables.actions.learn-more-about-yaml %}
16+
17+
To use a discussion category form in your repository, you must create a new file and add it to the `/.github/DISCUSSION_TEMPLATE/` folder in your repository.
18+
19+
You can also create discussion category forms for your organization. For more information, see "[Creating a default community health file](/communities/setting-up-your-project-for-healthy-contributions/creating-a-default-community-health-file)."
20+
21+
Discussion category forms are not supported for polls. For more information about polls, see "[About polls](/discussions/collaborating-with-your-community-using-discussions/about-discussions#about-polls)."
22+
23+
Here is the rendered version of the issue form.
24+
25+
![Screenshot of a rendered discussion category form](/assets/images/help/discussions/discussion-category-form-sample.png)
26+
27+
## Creating discussion category forms
28+
29+
People with write access to a repository can create a discussion category form.
30+
31+
1. Navigate to the repository where you want to create a discussion category form.
32+
2. In your repository, create a file called `/.github/DISCUSSION_TEMPLATE/FORM-NAME.yml`, replacing `FORM-NAME` with the name for your discussion category form. {% data reusables.discussions.discussion-category-forms-name %} For more information about creating new files on GitHub, see "[Creating new files](/github/managing-files-in-a-repository/creating-new-files)."
33+
3. In the body of the new file, type the contents of your discussion category form. For more information, see "[Syntax for discussion category forms](/discussions/managing-discussions-for-your-community/syntax-for-discussion-category-forms)."
34+
4. Commit your file to the default branch of your repository. For more information, see "[Creating new files](/github/managing-files-in-a-repository/creating-new-files)."

content/discussions/managing-discussions-for-your-community/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ children:
99
- /managing-categories-for-discussions
1010
- /moderating-discussions
1111
- /viewing-insights-for-your-discussions
12+
- /creating-discussion-category-forms
13+
- /syntax-for-discussion-category-forms
1214
---
1315

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: Syntax for discussion category forms
3+
shortTitle: Syntax for discussion category forms
4+
intro: 'You can use YAML syntax to define the fields in your discussion category forms.'
5+
versions:
6+
feature: discussion-category-forms
7+
---
8+
9+
{% data reusables.discussions.discussion-category-forms-beta %}
10+
11+
## About YAML syntax for discussion category forms
12+
13+
You can create custom discussion category forms by adding a YAML form definition file to the `/.github/DISCUSSION_TEMPLATE/` folder in your repository. {% data reusables.actions.learn-more-about-yaml %}
14+
15+
{% data reusables.discussions.discussion-category-forms-name %}
16+
17+
For each field, you can define the input type, validation, and a default label.
18+
19+
When a community member fills out a discussion form, their responses for each input are converted to markdown and added to the body of a discussion. Community members can edit their discussions that were created with a discussion form and other people can interact with the discussion like a discussion created through other methods.
20+
21+
This example YAML configuration file defines a general discussion category form.
22+
23+
{% data reusables.discussions.discussion-category-forms-sample %}
24+
25+
## Top-level syntax
26+
27+
The configuration file for a discussion category form must contain a `body` key, and the `body` must contain at least 1 non-Markdown field.
28+
29+
```YAML{:copy}
30+
body:
31+
- type: input
32+
id: suggestion
33+
attributes:
34+
label: Suggestion
35+
description: "How might we make this project better?"
36+
placeholder: "Adding a CODE_OF_CONDUCT.md file would be a great idea."
37+
validations:
38+
required: true
39+
```
40+
41+
You can set the following top-level keys for each issue form.
42+
43+
| Key | Description | Required | Type |
44+
| :-- | :-- | :-- | :-- | :-- |
45+
| `body` | Definition of the input types in the discussion form. | Required | Array |
46+
| `labels` | Labels that will automatically be added to discussions created with this template. | Optional | Array or comma-delimited string |
47+
| `title` | A default title that will be pre-populated in the discussion submission form. | Optional | String |
48+
49+
To add fields to your form, include an array of form elements in the `body` key. For a list of available elements and their syntaxes, see "[Syntax for {% data variables.product.prodname_dotcom %}'s form schema](/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema)."
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Issues 8484
2+
# Discussions Category Forms - [Public Beta]
3+
versions:
4+
fpt: '*'
5+
ghec: '*'
6+
ghes: '>=3.8'
7+
ghae: '>=3.8'
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% note %}
2+
3+
**Note:** Discussion category forms are currently in limited public beta and subject to change.
4+
5+
{% endnote %}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The name must correspond with the slug for one of your discussion categories. For example, the template for the "Announcements" category should be `.github/DISCUSSION_TEMPLATE/announcements.yml`.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
```YAML{:copy}
2+
title: "[General] "
3+
labels: ["General Introduction"]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
This is text that will show up in the template!
9+
- type: textarea
10+
id: improvements
11+
attributes:
12+
label: Top 3 improvements
13+
description: "What are the top 3 improvements we could make to this project?"
14+
value: |
15+
1.
16+
2.
17+
3.
18+
...
19+
render: bash
20+
validations:
21+
required: true
22+
- type: markdown
23+
attributes:
24+
value: |
25+
## Markdown header
26+
And some more markdown
27+
- type: input
28+
id: has-id
29+
attributes:
30+
label: Suggestions
31+
description: A description about suggestions to help you
32+
validations:
33+
required: true
34+
- type: dropdown
35+
id: download
36+
attributes:
37+
label: Which area of this project could be most improved?
38+
options:
39+
- Documentation
40+
- Pull request review time
41+
- Bug fix time
42+
- Release cadence
43+
validations:
44+
required: true
45+
- type: checkboxes
46+
attributes:
47+
label: Check that box!
48+
options:
49+
- label: This one!
50+
required: true
51+
- label: I won't stop you if you check this one, too
52+
- type: markdown
53+
attributes:
54+
value: |
55+
### The thrilling conclusion
56+
_to our template_
57+
58+
```

0 commit comments

Comments
 (0)