From 2970ebe9c459bfc0f5acdd5367f57ec3e7ba464d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Mar 2026 02:45:32 +0000 Subject: [PATCH] fix: remove required inputs from smoke-* workflows, always provide defaults Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com> Agent-Logs-Url: https://github.com/github/gh-aw/sessions/3e923da6-a161-47ac-ae10-b80ee3a98e9c --- .github/workflows/refiner.lock.yml | 3 ++- .github/workflows/smoke-claude.lock.yml | 10 ++++------ .github/workflows/smoke-claude.md | 6 ++++-- .github/workflows/smoke-copilot-arm.lock.yml | 8 +++----- .github/workflows/smoke-copilot-arm.md | 3 ++- .github/workflows/smoke-copilot.lock.yml | 11 +++++------ .github/workflows/smoke-copilot.md | 3 ++- pkg/workflow/label_trigger_parser.go | 7 +++++-- pkg/workflow/label_trigger_parser_test.go | 9 +++++++-- .../testdata/wasm_golden/fixtures/smoke-copilot.md | 3 ++- pkg/workflow/tools.go | 7 +++++-- 11 files changed, 41 insertions(+), 29 deletions(-) diff --git a/.github/workflows/refiner.lock.yml b/.github/workflows/refiner.lock.yml index cb8a1743b61..3fcd67a7b03 100644 --- a/.github/workflows/refiner.lock.yml +++ b/.github/workflows/refiner.lock.yml @@ -34,8 +34,9 @@ name: "Code Refiner" workflow_dispatch: inputs: item_number: + default: "" description: The number of the pull request - required: true + required: false type: string permissions: {} diff --git a/.github/workflows/smoke-claude.lock.yml b/.github/workflows/smoke-claude.lock.yml index 17cbc4b1f31..3570b7b8920 100644 --- a/.github/workflows/smoke-claude.lock.yml +++ b/.github/workflows/smoke-claude.lock.yml @@ -34,7 +34,7 @@ # # inlined-imports: true # -# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"fe699b7701341977425ab709b5fa92bd1ca9d99e83fc3f6472e7749dbfe01e02","agent_id":"claude"} +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"8f9bc9e256d1dc711cd46dec1bebe5d1145368d1255dae6f14fc9b440d2adacf","agent_id":"claude"} name: "Smoke Claude" "on": @@ -865,7 +865,7 @@ jobs: mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs cat > ${RUNNER_TEMP}/gh-aw/safeoutputs/config.json << 'GH_AW_SAFE_OUTPUTS_CONFIG_EOF' - {"add_comment":{"max":2},"add_labels":{"allowed":["smoke-claude"],"max":3},"add_reviewer":{"max":2},"close_pull_request":{"max":1,"staged":true},"create_issue":{"expires":2,"group":true,"max":1},"create_pull_request_review_comment":{"max":5},"missing_data":{},"missing_tool":{},"noop":{"max":1},"post_slack_message":{"description":"Post a message to a fictitious Slack channel (smoke test only — no real Slack integration)","inputs":{"channel":{"default":null,"description":"Slack channel name to post to","required":true,"type":"string"},"message":{"default":null,"description":"Message text to post","required":true,"type":"string"}}},"push_to_pull_request_branch":{"max":1,"target":"*"},"resolve_pull_request_review_thread":{"max":5},"submit_pull_request_review":{"max":1},"update_pull_request":{"max":1}} + {"add_comment":{"max":2},"add_labels":{"allowed":["smoke-claude"],"max":3},"add_reviewer":{"max":2},"close_pull_request":{"max":1,"staged":true},"create_issue":{"expires":2,"group":true,"max":1},"create_pull_request_review_comment":{"max":5},"missing_data":{},"missing_tool":{},"noop":{"max":1},"post_slack_message":{"description":"Post a message to a fictitious Slack channel (smoke test only — no real Slack integration)","inputs":{"channel":{"default":"#general","description":"Slack channel name to post to","required":false,"type":"string"},"message":{"description":"Message text to post","required":false,"type":"string"}}},"push_to_pull_request_branch":{"max":1,"target":"*"},"resolve_pull_request_review_thread":{"max":5},"submit_pull_request_review":{"max":1},"update_pull_request":{"max":1}} GH_AW_SAFE_OUTPUTS_CONFIG_EOF - name: Write Safe Outputs Tools run: | @@ -890,18 +890,16 @@ jobs: "additionalProperties": false, "properties": { "channel": { + "default": "#general", "description": "Slack channel name to post to", "type": "string" }, "message": { + "default": "", "description": "Message text to post", "type": "string" } }, - "required": [ - "channel", - "message" - ], "type": "object" }, "name": "post_slack_message" diff --git a/.github/workflows/smoke-claude.md b/.github/workflows/smoke-claude.md index 39a42041613..44a611b0def 100644 --- a/.github/workflows/smoke-claude.md +++ b/.github/workflows/smoke-claude.md @@ -102,11 +102,13 @@ safe-outputs: inputs: channel: description: Slack channel name to post to - required: true + required: false + default: "#general" type: string message: description: Message text to post - required: true + required: false + default: "" type: string script: | const targetChannel = item.channel || "#general"; diff --git a/.github/workflows/smoke-copilot-arm.lock.yml b/.github/workflows/smoke-copilot-arm.lock.yml index ff90f582c7b..33432c7b722 100644 --- a/.github/workflows/smoke-copilot-arm.lock.yml +++ b/.github/workflows/smoke-copilot-arm.lock.yml @@ -28,7 +28,7 @@ # - shared/github-queries-mcp-script.md # - shared/reporting.md # -# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"b8c52bb25dd5e53dd4cd9c19582e7759a58d025d7218306c34c3789d82c383e9","agent_id":"copilot"} +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"3d0ce3db1a07629a0c6da7a8917991c662b5f4c888048bdf03e56364dce8bad6","agent_id":"copilot"} name: "Smoke Copilot ARM64" "on": @@ -489,7 +489,7 @@ jobs: mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs cat > ${RUNNER_TEMP}/gh-aw/safeoutputs/config.json << 'GH_AW_SAFE_OUTPUTS_CONFIG_EOF' - {"add_comment":{"allowed_repos":["github/gh-aw"],"max":2},"add_labels":{"allowed":["smoke-copilot-arm"],"allowed_repos":["github/gh-aw"],"max":3},"create_discussion":{"expires":2,"max":1},"create_issue":{"expires":2,"group":true,"max":1},"create_pull_request_review_comment":{"max":5},"dispatch_workflow":{"max":1,"workflow_files":{"haiku-printer":".yml"},"workflows":["haiku-printer"]},"missing_data":{},"missing_tool":{},"noop":{"max":1},"remove_labels":{"allowed":["smoke"],"max":3},"send-slack-message":{"description":"Send a message to Slack (stub for testing)","inputs":{"message":{"default":null,"description":"The message to send","required":true,"type":"string"}},"output":"Slack message stub executed!"},"submit_pull_request_review":{"max":1}} + {"add_comment":{"allowed_repos":["github/gh-aw"],"max":2},"add_labels":{"allowed":["smoke-copilot-arm"],"allowed_repos":["github/gh-aw"],"max":3},"create_discussion":{"expires":2,"max":1},"create_issue":{"expires":2,"group":true,"max":1},"create_pull_request_review_comment":{"max":5},"dispatch_workflow":{"max":1,"workflow_files":{"haiku-printer":".yml"},"workflows":["haiku-printer"]},"missing_data":{},"missing_tool":{},"noop":{"max":1},"remove_labels":{"allowed":["smoke"],"max":3},"send-slack-message":{"description":"Send a message to Slack (stub for testing)","inputs":{"message":{"description":"The message to send","required":false,"type":"string"}},"output":"Slack message stub executed!"},"submit_pull_request_review":{"max":1}} GH_AW_SAFE_OUTPUTS_CONFIG_EOF - name: Write Safe Outputs Tools run: | @@ -521,13 +521,11 @@ jobs: "additionalProperties": false, "properties": { "message": { + "default": "", "description": "The message to send", "type": "string" } }, - "required": [ - "message" - ], "type": "object" }, "name": "send_slack_message" diff --git a/.github/workflows/smoke-copilot-arm.md b/.github/workflows/smoke-copilot-arm.md index 39abe9bbd6a..8bcbb578970 100644 --- a/.github/workflows/smoke-copilot-arm.md +++ b/.github/workflows/smoke-copilot-arm.md @@ -81,7 +81,8 @@ safe-outputs: inputs: message: description: "The message to send" - required: true + required: false + default: "" type: string permissions: contents: read diff --git a/.github/workflows/smoke-copilot.lock.yml b/.github/workflows/smoke-copilot.lock.yml index cf5c052ce9f..e901688f307 100644 --- a/.github/workflows/smoke-copilot.lock.yml +++ b/.github/workflows/smoke-copilot.lock.yml @@ -28,7 +28,7 @@ # - shared/github-queries-mcp-script.md # - shared/reporting.md # -# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"9a25686dcb16bf3ce0e37b5b72799686f0fc1d8cd14a06249604373fb9d0a59c","agent_id":"copilot"} +# gh-aw-metadata: {"schema_version":"v3","frontmatter_hash":"dfbfd7066ce29a36942300365649f587c371047cae891605ea3e611ccec93dac","agent_id":"copilot"} name: "Smoke Copilot" "on": @@ -40,8 +40,9 @@ name: "Smoke Copilot" workflow_dispatch: inputs: item_number: + default: "" description: The number of the issue, pull request, or discussion - required: true + required: false type: string permissions: {} @@ -496,7 +497,7 @@ jobs: mkdir -p /tmp/gh-aw/safeoutputs mkdir -p /tmp/gh-aw/mcp-logs/safeoutputs cat > ${RUNNER_TEMP}/gh-aw/safeoutputs/config.json << 'GH_AW_SAFE_OUTPUTS_CONFIG_EOF' - {"add_comment":{"allowed_repos":["github/gh-aw"],"max":2},"add_labels":{"allowed":["smoke-copilot"],"allowed_repos":["github/gh-aw"],"max":3},"create_discussion":{"expires":2,"max":1},"create_issue":{"expires":2,"group":true,"max":1},"create_pull_request_review_comment":{"max":5},"dispatch_workflow":{"max":1,"workflow_files":{"haiku-printer":".yml"},"workflows":["haiku-printer"]},"missing_data":{},"missing_tool":{},"noop":{"max":1},"remove_labels":{"allowed":["smoke"],"max":3},"reply_to_pull_request_review_comment":{"max":5},"send-slack-message":{"description":"Send a message to Slack (stub for testing)","inputs":{"message":{"default":null,"description":"The message to send","required":true,"type":"string"}},"output":"Slack message stub executed!"},"set_issue_type":{"max":5},"submit_pull_request_review":{"max":1}} + {"add_comment":{"allowed_repos":["github/gh-aw"],"max":2},"add_labels":{"allowed":["smoke-copilot"],"allowed_repos":["github/gh-aw"],"max":3},"create_discussion":{"expires":2,"max":1},"create_issue":{"expires":2,"group":true,"max":1},"create_pull_request_review_comment":{"max":5},"dispatch_workflow":{"max":1,"workflow_files":{"haiku-printer":".yml"},"workflows":["haiku-printer"]},"missing_data":{},"missing_tool":{},"noop":{"max":1},"remove_labels":{"allowed":["smoke"],"max":3},"reply_to_pull_request_review_comment":{"max":5},"send-slack-message":{"description":"Send a message to Slack (stub for testing)","inputs":{"message":{"description":"The message to send","required":false,"type":"string"}},"output":"Slack message stub executed!"},"set_issue_type":{"max":5},"submit_pull_request_review":{"max":1}} GH_AW_SAFE_OUTPUTS_CONFIG_EOF - name: Write Safe Outputs Tools run: | @@ -529,13 +530,11 @@ jobs: "additionalProperties": false, "properties": { "message": { + "default": "", "description": "The message to send", "type": "string" } }, - "required": [ - "message" - ], "type": "object" }, "name": "send_slack_message" diff --git a/.github/workflows/smoke-copilot.md b/.github/workflows/smoke-copilot.md index cdf79211f9f..b923293ed8c 100644 --- a/.github/workflows/smoke-copilot.md +++ b/.github/workflows/smoke-copilot.md @@ -89,7 +89,8 @@ safe-outputs: inputs: message: description: "The message to send" - required: true + required: false + default: "" type: string permissions: contents: read diff --git a/pkg/workflow/label_trigger_parser.go b/pkg/workflow/label_trigger_parser.go index 832863bd60d..24a6fcaa470 100644 --- a/pkg/workflow/label_trigger_parser.go +++ b/pkg/workflow/label_trigger_parser.go @@ -117,12 +117,15 @@ func expandLabelTriggerShorthand(entityType string, labelNames []string) map[str } triggerConfig["names"] = namesAny - // Create workflow_dispatch with item_number input + // Create workflow_dispatch with item_number input (not required so the workflow can be + // triggered manually without providing a value; the activation job will fall back to + // the event payload when item_number is not supplied). workflowDispatchConfig := map[string]any{ "inputs": map[string]any{ "item_number": map[string]any{ "description": "The number of the " + getItemTypeName(entityType), - "required": true, + "required": false, + "default": "", "type": "string", }, }, diff --git a/pkg/workflow/label_trigger_parser_test.go b/pkg/workflow/label_trigger_parser_test.go index 5f566deeaa2..cb51718ef3f 100644 --- a/pkg/workflow/label_trigger_parser_test.go +++ b/pkg/workflow/label_trigger_parser_test.go @@ -426,8 +426,13 @@ func TestExpandLabelTriggerShorthand(t *testing.T) { } required, ok := itemNumber["required"].(bool) - if !ok || !required { - t.Errorf("expandLabelTriggerShorthand() required = %v, want true", required) + if !ok || required { + t.Errorf("expandLabelTriggerShorthand() required = %v, want false", required) + } + + defaultVal, ok := itemNumber["default"].(string) + if !ok || defaultVal != "" { + t.Errorf("expandLabelTriggerShorthand() default = %v, want empty string", defaultVal) } inputType, ok := itemNumber["type"].(string) diff --git a/pkg/workflow/testdata/wasm_golden/fixtures/smoke-copilot.md b/pkg/workflow/testdata/wasm_golden/fixtures/smoke-copilot.md index 2874c152feb..6fdab6187fa 100644 --- a/pkg/workflow/testdata/wasm_golden/fixtures/smoke-copilot.md +++ b/pkg/workflow/testdata/wasm_golden/fixtures/smoke-copilot.md @@ -78,7 +78,8 @@ safe-outputs: inputs: message: description: "The message to send" - required: true + required: false + default: "" type: string permissions: contents: read diff --git a/pkg/workflow/tools.go b/pkg/workflow/tools.go index 456935433d4..49eca12e32d 100644 --- a/pkg/workflow/tools.go +++ b/pkg/workflow/tools.go @@ -170,12 +170,15 @@ func (c *Compiler) applyDefaults(data *WorkflowData, markdownPath string) error } } - // Add workflow_dispatch with item_number input for manual testing + // Add workflow_dispatch with item_number input for manual testing. + // Not required so the workflow can be triggered without providing a value; + // the activation job falls back to the event payload when item_number is omitted. labelEventsMap["workflow_dispatch"] = map[string]any{ "inputs": map[string]any{ "item_number": map[string]any{ "description": "The number of the issue, pull request, or discussion", - "required": true, + "required": false, + "default": "", "type": "string", }, },