-
Notifications
You must be signed in to change notification settings - Fork 308
fix: allow wildcard target-repo: "*" in safe-output handlers
#21877
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
Changes from all commits
5f723a6
f58f442
6937e72
b630d27
d645442
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,6 +68,22 @@ func TestAddCommentTargetRepoIntegration(t *testing.T) { | |
| shouldHaveTargetRepo: false, // Trial mode sets env var, not config | ||
| expectedTargetRepoValue: "", // Not checked | ||
| }, | ||
| { | ||
| name: "target-repo wildcard should be in handler config", | ||
| frontmatter: map[string]any{ | ||
| "name": "Test Workflow", | ||
| "engine": "copilot", | ||
| "safe-outputs": map[string]any{ | ||
| "add-comment": map[string]any{ | ||
| "max": 1, | ||
| "target": "*", | ||
| "target-repo": "*", | ||
| }, | ||
| }, | ||
|
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. Good addition of a test case for the wildcard |
||
| }, | ||
| shouldHaveTargetRepo: true, | ||
| expectedTargetRepoValue: "*", | ||
| }, | ||
| { | ||
| name: "no target-repo and no trial should not have target-repo in handler config", | ||
| frontmatter: map[string]any{ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,15 +30,17 @@ func TestAddCommentsConfigTargetRepo(t *testing.T) { | |
| shouldBeNil: false, | ||
| }, | ||
| { | ||
| name: "target-repo with wildcard should be rejected", | ||
| name: "target-repo with wildcard is allowed", | ||
| configMap: map[string]any{ | ||
| "add-comment": map[string]any{ | ||
| "max": 5, | ||
| "target": "123", | ||
| "max": 1, | ||
| "target": "*", | ||
| "target-repo": "*", | ||
| }, | ||
| }, | ||
| shouldBeNil: true, // Configuration should be nil due to validation | ||
| expectedTarget: "*", | ||
| expectedRepo: "*", | ||
| shouldBeNil: false, // Wildcard "*" is a valid target-repo for add-comment | ||
| }, | ||
| { | ||
| name: "target-repo without target field", | ||
|
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. Good change — the test name update from "should be rejected" to "is allowed" correctly reflects the new intended behavior that wildcard |
||
|
|
||
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.
Now that the
target-repo: "*"wildcard is allowed, the handler config correctly receives and passes the wildcard value. The existing discussion field validation below still works correctly. ✅