diff --git a/pkg/parser/schema_test.go b/pkg/parser/schema_test.go index a947eae3194..e169b57396e 100644 --- a/pkg/parser/schema_test.go +++ b/pkg/parser/schema_test.go @@ -1025,6 +1025,25 @@ func TestGetSafeOutputTypeKeys(t *testing.T) { } } +func TestMainWorkflowSchema_CreateDiscussionRequiredCategoryAllowed(t *testing.T) { + t.Parallel() + + frontmatter := map[string]any{ + "on": "daily", + "safe-outputs": map[string]any{ + "create-discussion": map[string]any{ + "category": "Ideas", + "close-older-discussions": true, + "required-category": "Ideas", + }, + }, + } + + if err := validateWithSchema(frontmatter, mainWorkflowSchema, "main workflow file"); err != nil { + t.Fatalf("expected create-discussion.required-category to pass schema validation, got: %v", err) + } +} + func TestMainWorkflowSchemaPushToPullRequestBranchHasMaxPatchSize(t *testing.T) { schemaPath := "schemas/main_workflow_schema.json" schemaContent, err := os.ReadFile(schemaPath) diff --git a/pkg/parser/schemas/main_workflow_schema.json b/pkg/parser/schemas/main_workflow_schema.json index b5040a2d38e..7a0917681ef 100644 --- a/pkg/parser/schemas/main_workflow_schema.json +++ b/pkg/parser/schemas/main_workflow_schema.json @@ -5689,6 +5689,10 @@ "minLength": 1, "pattern": "\\S" }, + "required-category": { + "type": "string", + "description": "Required category for matching when close-older-discussions is enabled. Only discussions in this category will be considered when searching for older discussions to close." + }, "fallback-to-issue": { "type": "boolean", "description": "When true (default), fallback to creating an issue if discussion creation fails due to permissions. The fallback issue will include a note indicating it was intended to be a discussion. If close-older-discussions is enabled, the close-older-issues logic will be applied to the fallback issue.", @@ -5762,7 +5766,8 @@ { "title-prefix": "[weekly-report] ", "category": "reports", - "close-older-discussions": true + "close-older-discussions": true, + "required-category": "reports" }, { "labels": ["weekly-report", "automation"],