diff --git a/pkg/cli/workflows/test-copilot-call-workflow.md b/pkg/cli/workflows/test-copilot-call-workflow.md new file mode 100644 index 00000000000..cc557c11e85 --- /dev/null +++ b/pkg/cli/workflows/test-copilot-call-workflow.md @@ -0,0 +1,23 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + actions: read +engine: copilot +safe-outputs: + call-workflow: + max: 1 + workflows: + - test-copilot-noop +--- + +# Test Copilot Call Workflow + +Test the `call_workflow` safe output type with the Copilot engine. + +## Task + +Call the reusable workflow "test-copilot-noop" as a fan-out job. + +Output results in JSONL format using the `call_workflow` tool. diff --git a/pkg/cli/workflows/test-copilot-close-issue.md b/pkg/cli/workflows/test-copilot-close-issue.md new file mode 100644 index 00000000000..80550082ea4 --- /dev/null +++ b/pkg/cli/workflows/test-copilot-close-issue.md @@ -0,0 +1,21 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + issues: read +engine: copilot +safe-outputs: + close-issue: + max: 1 +--- + +# Test Copilot Close Issue + +Test the `close_issue` safe output type with the Copilot engine. + +## Task + +Close issue #1 with a reason of "completed" and a comment "Closing this issue as it has been resolved by the automated test workflow." + +Output results in JSONL format using the `close_issue` tool. diff --git a/pkg/cli/workflows/test-copilot-create-code-scanning-alerts.md b/pkg/cli/workflows/test-copilot-create-code-scanning-alerts.md new file mode 100644 index 00000000000..38e49cb0250 --- /dev/null +++ b/pkg/cli/workflows/test-copilot-create-code-scanning-alerts.md @@ -0,0 +1,29 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + security-events: read +engine: copilot +safe-outputs: + create-code-scanning-alerts: + driver: Test Scanner + max: 3 +timeout-minutes: 5 +--- + +# Test Copilot Create Code Scanning Alerts + +Test the `create_code_scanning_alert` safe output type with the Copilot engine. + +## Task + +Create a code scanning alert with the following details: +- **rule_id**: "TEST001" +- **rule_description**: "Test security rule for automated testing" +- **message**: "Found a potential test vulnerability" +- **path**: "src/test.js" +- **start_line**: 42 +- **severity**: "warning" + +Output results in JSONL format using the `create_code_scanning_alert` tool. diff --git a/pkg/cli/workflows/test-copilot-create-discussion.md b/pkg/cli/workflows/test-copilot-create-discussion.md new file mode 100644 index 00000000000..9d4e03d9e4b --- /dev/null +++ b/pkg/cli/workflows/test-copilot-create-discussion.md @@ -0,0 +1,21 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read +engine: copilot +safe-outputs: + create-discussion: + max: 1 + category: general +--- + +# Test Copilot Create Discussion + +Test the `create_discussion` safe output type with the Copilot engine. + +## Task + +Create a new GitHub discussion with the title "Test Discussion from Copilot" and the body "This discussion was created automatically by the Copilot test workflow to verify the create_discussion safe output type works correctly." + +Output results in JSONL format using the `create_discussion` tool. diff --git a/pkg/cli/workflows/test-copilot-create-project-status-update.md b/pkg/cli/workflows/test-copilot-create-project-status-update.md new file mode 100644 index 00000000000..665e0c6f51a --- /dev/null +++ b/pkg/cli/workflows/test-copilot-create-project-status-update.md @@ -0,0 +1,21 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + issues: read +engine: copilot +safe-outputs: + create-project-status-update: + max: 1 +--- + +# Test Copilot Create Project Status Update + +Test the `create_project_status_update` safe output type with the Copilot engine. + +## Task + +Create a status update for a GitHub Project V2. Set the status to "ON_TRACK" with a body message "All tasks are progressing as planned. No blockers identified." + +Output results in JSONL format using the `create_project_status_update` tool. diff --git a/pkg/cli/workflows/test-copilot-create-project.md b/pkg/cli/workflows/test-copilot-create-project.md new file mode 100644 index 00000000000..0468219eb9f --- /dev/null +++ b/pkg/cli/workflows/test-copilot-create-project.md @@ -0,0 +1,21 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + issues: read +engine: copilot +safe-outputs: + create-project: + max: 1 +--- + +# Test Copilot Create Project + +Test the `create_project` safe output type with the Copilot engine. + +## Task + +Create a new GitHub Project V2 with the title "Test Project from Copilot" and description "This project was created automatically by the Copilot test workflow to verify the create_project safe output type works correctly." + +Output results in JSONL format using the `create_project` tool. diff --git a/pkg/cli/workflows/test-copilot-dispatch-workflow.md b/pkg/cli/workflows/test-copilot-dispatch-workflow.md new file mode 100644 index 00000000000..d6ef46299f6 --- /dev/null +++ b/pkg/cli/workflows/test-copilot-dispatch-workflow.md @@ -0,0 +1,23 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + actions: read +engine: copilot +safe-outputs: + dispatch-workflow: + max: 1 + workflows: + - test-copilot-noop +--- + +# Test Copilot Dispatch Workflow + +Test the `dispatch_workflow` safe output type with the Copilot engine. + +## Task + +Dispatch the workflow "test-copilot-noop" with no additional inputs. + +Output results in JSONL format using the `dispatch_workflow` tool. diff --git a/pkg/cli/workflows/test-copilot-link-sub-issue.md b/pkg/cli/workflows/test-copilot-link-sub-issue.md new file mode 100644 index 00000000000..37a0b960bc1 --- /dev/null +++ b/pkg/cli/workflows/test-copilot-link-sub-issue.md @@ -0,0 +1,21 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + issues: read +engine: copilot +safe-outputs: + link-sub-issue: + max: 5 +--- + +# Test Copilot Link Sub-Issue + +Test the `link_sub_issue` safe output type with the Copilot engine. + +## Task + +Link issue #2 as a sub-issue of issue #1. This establishes a parent-child relationship between the two issues. + +Output results in JSONL format using the `link_sub_issue` tool. diff --git a/pkg/cli/workflows/test-copilot-missing-data.md b/pkg/cli/workflows/test-copilot-missing-data.md new file mode 100644 index 00000000000..3aa7f46d5f5 --- /dev/null +++ b/pkg/cli/workflows/test-copilot-missing-data.md @@ -0,0 +1,27 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + actions: read + issues: read + pull-requests: read +engine: copilot +safe-outputs: + missing-data: + max: 5 +timeout-minutes: 5 +--- + +# Test Copilot Missing Data + +Test the `missing_data` safe output type with the Copilot engine. + +## Task + +Report missing data with transparency messages about the following: +- "Required issue number not found in the workflow trigger context" +- "Expected pull request branch name but no PR was associated with this run" +- "Configuration file 'config.json' not found in the repository root" + +Output results in JSONL format using the `missing_data` tool. diff --git a/pkg/cli/workflows/test-copilot-remove-labels.md b/pkg/cli/workflows/test-copilot-remove-labels.md new file mode 100644 index 00000000000..6e9d3e1627c --- /dev/null +++ b/pkg/cli/workflows/test-copilot-remove-labels.md @@ -0,0 +1,21 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + issues: read +engine: copilot +safe-outputs: + remove-labels: + max: 5 +--- + +# Test Copilot Remove Labels + +Test the `remove_labels` safe output type with the Copilot engine. + +## Task + +Remove the label "bug" from issue #1. + +Output results in JSONL format using the `remove_labels` tool. diff --git a/pkg/cli/workflows/test-copilot-reply-to-pull-request-review-comment.md b/pkg/cli/workflows/test-copilot-reply-to-pull-request-review-comment.md new file mode 100644 index 00000000000..e890d5f341a --- /dev/null +++ b/pkg/cli/workflows/test-copilot-reply-to-pull-request-review-comment.md @@ -0,0 +1,21 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + pull-requests: read +engine: copilot +safe-outputs: + reply-to-pull-request-review-comment: + max: 1 +--- + +# Test Copilot Reply to Pull Request Review Comment + +Test the `reply_to_pull_request_review_comment` safe output type with the Copilot engine. + +## Task + +Reply to pull request review comment #1 with the body "Thank you for the review comment. This is an automated test reply from the Copilot test workflow." + +Output results in JSONL format using the `reply_to_pull_request_review_comment` tool. diff --git a/pkg/cli/workflows/test-copilot-resolve-pull-request-review-thread.md b/pkg/cli/workflows/test-copilot-resolve-pull-request-review-thread.md new file mode 100644 index 00000000000..3449f0309f4 --- /dev/null +++ b/pkg/cli/workflows/test-copilot-resolve-pull-request-review-thread.md @@ -0,0 +1,21 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + pull-requests: read +engine: copilot +safe-outputs: + resolve-pull-request-review-thread: + max: 5 +--- + +# Test Copilot Resolve Pull Request Review Thread + +Test the `resolve_pull_request_review_thread` safe output type with the Copilot engine. + +## Task + +Resolve the pull request review thread with thread ID "PRRT_test123". This indicates the discussion in the thread has been addressed. + +Output results in JSONL format using the `resolve_pull_request_review_thread` tool. diff --git a/pkg/cli/workflows/test-copilot-submit-pull-request-review.md b/pkg/cli/workflows/test-copilot-submit-pull-request-review.md new file mode 100644 index 00000000000..90442fdea5d --- /dev/null +++ b/pkg/cli/workflows/test-copilot-submit-pull-request-review.md @@ -0,0 +1,21 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + pull-requests: read +engine: copilot +safe-outputs: + submit-pull-request-review: + max: 1 +--- + +# Test Copilot Submit Pull Request Review + +Test the `submit_pull_request_review` safe output type with the Copilot engine. + +## Task + +Submit a COMMENT review on pull request #1 with the body "This is a test review comment submitted by the automated test workflow to verify the submit_pull_request_review safe output type works correctly." + +Output results in JSONL format using the `submit_pull_request_review` tool. diff --git a/pkg/cli/workflows/test-copilot-update-project.md b/pkg/cli/workflows/test-copilot-update-project.md new file mode 100644 index 00000000000..ddf5f68206e --- /dev/null +++ b/pkg/cli/workflows/test-copilot-update-project.md @@ -0,0 +1,21 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + issues: read +engine: copilot +safe-outputs: + update-project: + max: 5 +--- + +# Test Copilot Update Project + +Test the `update_project` safe output type with the Copilot engine. + +## Task + +Add issue #1 to a GitHub Project V2. Set the status field to "In Progress" for the added item. + +Output results in JSONL format using the `update_project` tool. diff --git a/pkg/cli/workflows/test-copilot-update-pull-request.md b/pkg/cli/workflows/test-copilot-update-pull-request.md new file mode 100644 index 00000000000..e88e5c8747c --- /dev/null +++ b/pkg/cli/workflows/test-copilot-update-pull-request.md @@ -0,0 +1,21 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + pull-requests: read +engine: copilot +safe-outputs: + update-pull-request: + max: 1 +--- + +# Test Copilot Update Pull Request + +Test the `update_pull_request` safe output type with the Copilot engine. + +## Task + +Update pull request #1 with a new title "Updated PR Title" and body "This PR body was updated by the Copilot test workflow to verify the update_pull_request safe output type works correctly." + +Output results in JSONL format using the `update_pull_request` tool. diff --git a/pkg/workflow/compiler_safe_outputs_config_test.go b/pkg/workflow/compiler_safe_outputs_config_test.go index 5d91cf87e61..dcf90840e02 100644 --- a/pkg/workflow/compiler_safe_outputs_config_test.go +++ b/pkg/workflow/compiler_safe_outputs_config_test.go @@ -280,6 +280,175 @@ func TestAddHandlerManagerConfigEnvVar(t *testing.T) { checkJSON: true, expectedKeys: []string{"call_workflow"}, }, + { + name: "submit_pull_request_review config", + safeOutputs: &SafeOutputsConfig{ + SubmitPullRequestReview: &SubmitPullRequestReviewConfig{ + BaseSafeOutputConfig: BaseSafeOutputConfig{ + Max: strPtr("1"), + }, + }, + }, + checkContains: []string{ + "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG", + }, + checkJSON: true, + expectedKeys: []string{"submit_pull_request_review"}, + }, + { + name: "reply_to_pull_request_review_comment config", + safeOutputs: &SafeOutputsConfig{ + ReplyToPullRequestReviewComment: &ReplyToPullRequestReviewCommentConfig{ + BaseSafeOutputConfig: BaseSafeOutputConfig{ + Max: strPtr("5"), + }, + }, + }, + checkContains: []string{ + "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG", + }, + checkJSON: true, + expectedKeys: []string{"reply_to_pull_request_review_comment"}, + }, + { + name: "resolve_pull_request_review_thread config", + safeOutputs: &SafeOutputsConfig{ + ResolvePullRequestReviewThread: &ResolvePullRequestReviewThreadConfig{ + BaseSafeOutputConfig: BaseSafeOutputConfig{ + Max: strPtr("10"), + }, + }, + }, + checkContains: []string{ + "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG", + }, + checkJSON: true, + expectedKeys: []string{"resolve_pull_request_review_thread"}, + }, + { + name: "create_code_scanning_alert config", + safeOutputs: &SafeOutputsConfig{ + CreateCodeScanningAlerts: &CreateCodeScanningAlertsConfig{ + BaseSafeOutputConfig: BaseSafeOutputConfig{ + Max: strPtr("3"), + }, + Driver: "Test Scanner", + }, + }, + checkContains: []string{ + "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG", + }, + checkJSON: true, + expectedKeys: []string{"create_code_scanning_alert"}, + }, + { + name: "remove_labels config", + safeOutputs: &SafeOutputsConfig{ + RemoveLabels: &RemoveLabelsConfig{ + Allowed: []string{"bug", "wontfix"}, + }, + }, + checkContains: []string{ + "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG", + }, + checkJSON: true, + expectedKeys: []string{"remove_labels"}, + }, + { + name: "update_pull_request config", + safeOutputs: &SafeOutputsConfig{ + UpdatePullRequests: &UpdatePullRequestsConfig{ + UpdateEntityConfig: UpdateEntityConfig{ + BaseSafeOutputConfig: BaseSafeOutputConfig{ + Max: strPtr("1"), + }, + }, + Title: testBoolPtr(true), + Body: testBoolPtr(true), + }, + }, + checkContains: []string{ + "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG", + }, + checkJSON: true, + expectedKeys: []string{"update_pull_request"}, + }, + { + name: "update_project config", + safeOutputs: &SafeOutputsConfig{ + UpdateProjects: &UpdateProjectConfig{ + BaseSafeOutputConfig: BaseSafeOutputConfig{ + Max: strPtr("5"), + }, + }, + }, + checkContains: []string{ + "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG", + }, + checkJSON: true, + expectedKeys: []string{"update_project"}, + }, + { + name: "create_project config", + safeOutputs: &SafeOutputsConfig{ + CreateProjects: &CreateProjectsConfig{ + BaseSafeOutputConfig: BaseSafeOutputConfig{ + Max: strPtr("1"), + }, + }, + }, + checkContains: []string{ + "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG", + }, + checkJSON: true, + expectedKeys: []string{"create_project"}, + }, + { + name: "create_project_status_update config", + safeOutputs: &SafeOutputsConfig{ + CreateProjectStatusUpdates: &CreateProjectStatusUpdateConfig{ + BaseSafeOutputConfig: BaseSafeOutputConfig{ + Max: strPtr("1"), + }, + }, + }, + checkContains: []string{ + "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG", + }, + checkJSON: true, + expectedKeys: []string{"create_project_status_update"}, + }, + { + name: "link_sub_issue config", + safeOutputs: &SafeOutputsConfig{ + LinkSubIssue: &LinkSubIssueConfig{ + BaseSafeOutputConfig: BaseSafeOutputConfig{ + Max: strPtr("5"), + }, + }, + }, + checkContains: []string{ + "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG", + }, + checkJSON: true, + expectedKeys: []string{"link_sub_issue"}, + }, + { + name: "dispatch_workflow config", + safeOutputs: &SafeOutputsConfig{ + DispatchWorkflow: &DispatchWorkflowConfig{ + BaseSafeOutputConfig: BaseSafeOutputConfig{ + Max: strPtr("1"), + }, + Workflows: []string{"worker-a"}, + }, + }, + checkContains: []string{ + "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG", + }, + checkJSON: true, + expectedKeys: []string{"dispatch_workflow"}, + }, } for _, tt := range tests {