Skip to content

Commit

Permalink
Issue form defaults for dropdowns and adding projects via issue forms…
Browse files Browse the repository at this point in the history
… (#39301)
  • Loading branch information
guntrip authored Aug 10, 2023
1 parent 9a9a41d commit 2640843
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ For example, the following form definition includes four form elements: a text a
multiple: false
options:
- 1.0.2 (Default)
- 1.0.3 (Edge)
- 1.0.3 (Edge){% ifversion issue-form-dropdown-defaults %}
default: 0{% endif %}
validations:
required: true
- type: checkboxes
Expand Down Expand Up @@ -203,6 +204,7 @@ You can use a `dropdown` element to add a dropdown menu in your form.
| `description` | A description of the dropdown to provide extra context or guidance, which is displayed in the form. | {% octicon "x" aria-label="Optional" %} | String | Empty String | {% octicon "dash" aria-label="Not applicable" %} |
| `multiple` | Determines if the user can select more than one option. | {% octicon "x" aria-label="Optional" %} | Boolean | false | {% octicon "dash" aria-label="Not applicable" %} |
| `options` | An array of options the user can choose from. Cannot be empty and all choices must be distinct. | {% octicon "check" aria-label="Required" %} | String array | {% octicon "dash" aria-label="Not applicable" %} | {% octicon "dash" aria-label="Not applicable" %} |
| `default` | Index of the preselected option in the `options` array. When a default option is specified, you cannot include "None" or "n/a" as options. | {% octicon "x" aria-label="Optional" %} | Integer | {% octicon "dash" aria-label="Not applicable" %} | {% octicon "dash" aria-label="Not applicable" %} |

#### Validations for `dropdown`

Expand All @@ -221,10 +223,11 @@ body:
attributes:
label: How did you download the software?
options:
- Built from source
- Homebrew
- MacPorts
- apt-get
- Built from source
- apt-get{% ifversion issue-form-dropdown-defaults %}
default: 0{% endif %}
validations:
required: true
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ You can set the following top-level keys for each issue form.
| `body` | Definition of the input types in the form. | Required | Array |
| `assignees` | People who will be automatically assigned to issues created with this template. | Optional | Array or comma-delimited string |
| `labels` | Labels that will automatically be added to issues created with this template. If a label does not already exist in the repository, it will not be automatically added to the issue. | Optional | Array or comma-delimited string |
| `title` | A default title that will be pre-populated in the issue submission form. | Optional | String |
| `title` | A default title that will be pre-populated in the issue submission form. | Optional | String |{% ifversion projects-in-issue-forms %}
| `projects` | Projects that any issues created with this template will automatically be added to. | Optional | Array or comma-delimited string |{% endif %}


For the available `body` input types and their syntaxes, see "[AUTOTITLE](/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema)."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Query parameter | Example
`labels` | `https://github.com/octo-org/octo-repo/issues/new?labels=help+wanted,bug` creates an issue with the labels "help wanted" and "bug".
`milestone` | `https://github.com/octo-org/octo-repo/issues/new?milestone=testing+milestones` creates an issue with the milestone "testing milestones."
`assignees` | `https://github.com/octo-org/octo-repo/issues/new?assignees=octocat` creates an issue and assigns it to @octocat.
`projects` | `https://github.com/octo-org/octo-repo/issues/new?title=Bug+fix&projects=octo-org/1` creates an issue with the title "Bug fix" and adds it to the organization's project board 1.
`projects` | `https://github.com/octo-org/octo-repo/issues/new?title=Bug+fix&projects=octo-org/1` creates an issue with the title "Bug fix" and adds it to the organization's project board 1. {% ifversion projects-v2 and projects-v1 %}{% ifversion projects-in-issue-forms %}{% else %}Only {% data variables.projects.projects_v1_boards %} can currently be specified in URL queries.{% endif %}{% endif %}
`template` | `https://github.com/octo-org/octo-repo/issues/new?template=issue_template.md` creates an issue with a template in the issue body. The `template` query parameter works with templates stored in an `ISSUE_TEMPLATE` subdirectory within the root, `docs/` or `.github/` directory in a repository. For more information, see "[AUTOTITLE](/communities/using-templates-to-encourage-useful-issues-and-pull-requests)."

{% ifversion fpt or ghec %}
Expand Down
6 changes: 6 additions & 0 deletions data/features/issue-form-dropdown-defaults.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ability to set a default in issue form dropdowns (#11231)
versions:
fpt: '*'
ghec: '*'
ghes: '>=3.11'
ghae: '>=3.11'
6 changes: 6 additions & 0 deletions data/features/projects-in-issue-forms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ability to set projects in issue forms (#11231)
versions:
fpt: '*'
ghec: '*'
ghes: '>=3.11'
ghae: '>=3.11'
6 changes: 4 additions & 2 deletions data/reusables/community/issue-forms-sample.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: ["bug", "triage"]
labels: ["bug", "triage"]{% ifversion projects-in-issue-forms %}
projects: ["octo-org/1", "octo-org/44"]{% endif %}
assignees:
- octocat
body:
Expand Down Expand Up @@ -34,7 +35,8 @@ body:
description: What version of our software are you running?
options:
- 1.0.2 (Default)
- 1.0.3 (Edge)
- 1.0.3 (Edge){% ifversion issue-form-dropdown-defaults %}
default: 0{% endif %}
validations:
required: true
- type: dropdown
Expand Down

0 comments on commit 2640843

Please sign in to comment.