feat: pre-fill custom fields from issue template YAML frontmatter #493

Closed
opened 2026-06-05 01:05:12 +00:00 by jmiller · 0 comments
Owner

Summary

Allow issue templates to specify default custom field values via YAML frontmatter. When a user creates an issue from a template, the custom fields are automatically pre-populated.

Proposed Syntax

name: Bug Report
about: Report a bug
labels:
  - type: bug
custom_fields:
  Type: Bug
  Priority: Medium
  Status: Pending Testing

Implementation

  1. Parse: Extend issue template frontmatter parser to read custom_fields map
  2. New issue form: Pre-select dropdown values and fill text inputs from template defaults
  3. New issue POST: Save custom field values alongside the issue on creation
  4. API: Include custom_fields in the create issue API request body

Files to Modify

  • modules/issue/template/template.go — parse custom_fields from frontmatter
  • routers/web/repo/issue.goNewIssuePost saves custom field values
  • templates/repo/issue/new/form.tmpl — render custom field inputs with defaults
  • routers/api/v1/repo/issue.go — accept custom_fields in create issue API

Example Flow

  1. User clicks New Issue > Bug Report template
  2. Form shows Type dropdown pre-selected to "Bug", Priority to "Medium"
  3. User fills in title/body and submits
  4. Issue created with custom fields already set

Benefits

  • Eliminates manual field selection for common issue types
  • Ensures consistent field values per template
  • Reduces clicks for issue reporters
  • Templates become the single source of truth for issue metadata

Dependencies

  • #483 (org-level custom fields) - DONE
  • Custom fields in issue sidebar - DONE

Co-Authored-By: Claude Opus 4.6 (1M context) noreply@anthropic.com

## Summary Allow issue templates to specify default custom field values via YAML frontmatter. When a user creates an issue from a template, the custom fields are automatically pre-populated. ## Proposed Syntax ```yaml name: Bug Report about: Report a bug labels: - type: bug custom_fields: Type: Bug Priority: Medium Status: Pending Testing ``` ## Implementation 1. **Parse**: Extend issue template frontmatter parser to read `custom_fields` map 2. **New issue form**: Pre-select dropdown values and fill text inputs from template defaults 3. **New issue POST**: Save custom field values alongside the issue on creation 4. **API**: Include `custom_fields` in the create issue API request body ## Files to Modify - `modules/issue/template/template.go` — parse `custom_fields` from frontmatter - `routers/web/repo/issue.go` — `NewIssuePost` saves custom field values - `templates/repo/issue/new/form.tmpl` — render custom field inputs with defaults - `routers/api/v1/repo/issue.go` — accept `custom_fields` in create issue API ## Example Flow 1. User clicks New Issue > Bug Report template 2. Form shows Type dropdown pre-selected to "Bug", Priority to "Medium" 3. User fills in title/body and submits 4. Issue created with custom fields already set ## Benefits - Eliminates manual field selection for common issue types - Ensures consistent field values per template - Reduces clicks for issue reporters - Templates become the single source of truth for issue metadata ## Dependencies - #483 (org-level custom fields) - DONE - Custom fields in issue sidebar - DONE --- _Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>_
Sign in to join this conversation.
No labels
Type Feature
Status
Priority
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: MokoConsulting/MokoGitea#493