-
Notifications
You must be signed in to change notification settings - Fork 424
schema: allow required-category in safe-outputs.create-discussion and add regression coverage
#39640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
schema: allow required-category in safe-outputs.create-discussion and add regression coverage
#39640
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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." | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [/grill-with-docs] The 💡 Suggested addition to examples{
"title-prefix": "[weekly-report] ",
"category": "Ideas",
"close-older-discussions": true,
"required-category": "Ideas"
}This directly mirrors the motivating use-case from the PR description and helps schema-aware editors surface the field when
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added the requested example in |
||
| }, | ||
| "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"], | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[/tdd] This bug fix lacks a regression test — the same copy-omission could silently re-appear.
💡 Suggested test
A targeted schema-validation test (similar to
safe_outputs_error_location_test.go) would anchor the fix:{ name: "create-discussion with required-category is valid", yamlContent: `on: daily safe-outputs: create-discussion: category: Ideas close-older-discussions: true required-category: Ideas`, expectValid: true, description: "required-category must be accepted in create-discussion branch", },Without it, the field could be silently dropped from the schema again (e.g., during a bulk property-list regeneration) and no test would catch it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a regression test in
/home/runner/work/gh-aw/gh-aw/pkg/parser/schema_test.go(TestMainWorkflowSchema_CreateDiscussionRequiredCategoryAllowed) that validatessafe-outputs.create-discussion.required-categorypasses strict schema validation withclose-older-discussions: true.