From a58d97c569f3f83942aa04de193c58277e9cbcf5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 20 Apr 2026 23:10:56 +0000 Subject: [PATCH] Add merge-pull-request test workflow and compiler test Add missing test coverage for the merge-pull-request safe output type: - New test workflow: pkg/cli/workflows/test-copilot-merge-pull-request.md - New Go test case: merge_pull_request config in compiler_safe_outputs_config_test.go Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../test-copilot-merge-pull-request.md | 26 +++++++++++++++++++ .../compiler_safe_outputs_config_test.go | 17 ++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 pkg/cli/workflows/test-copilot-merge-pull-request.md diff --git a/pkg/cli/workflows/test-copilot-merge-pull-request.md b/pkg/cli/workflows/test-copilot-merge-pull-request.md new file mode 100644 index 00000000000..e9551ae13fc --- /dev/null +++ b/pkg/cli/workflows/test-copilot-merge-pull-request.md @@ -0,0 +1,26 @@ +--- +on: + workflow_dispatch: +permissions: + contents: read + pull-requests: read +engine: copilot +safe-outputs: + merge-pull-request: + max: 1 + required-labels: ["automerge"] + allowed-branches: ["feature/*", "fix/*"] +timeout-minutes: 5 +--- + +# Test Copilot Merge Pull Request + +Test the `merge_pull_request` safe output type with the Copilot engine. + +## Task + +Merge pull request #1 using the "squash" merge method with: +- commit_title: "Test: Squash merge via automated workflow" +- commit_message: "This pull request was merged automatically by the Copilot test workflow to verify the merge_pull_request safe output type." + +Output results in JSONL format using the `merge_pull_request` tool. diff --git a/pkg/workflow/compiler_safe_outputs_config_test.go b/pkg/workflow/compiler_safe_outputs_config_test.go index 578303508d7..908a60393d3 100644 --- a/pkg/workflow/compiler_safe_outputs_config_test.go +++ b/pkg/workflow/compiler_safe_outputs_config_test.go @@ -757,6 +757,23 @@ func TestAddHandlerManagerConfigEnvVar(t *testing.T) { checkJSON: true, expectedKeys: []string{"report_incomplete"}, }, + { + name: "merge_pull_request config", + safeOutputs: &SafeOutputsConfig{ + MergePullRequest: &MergePullRequestConfig{ + BaseSafeOutputConfig: BaseSafeOutputConfig{ + Max: strPtr("1"), + }, + RequiredLabels: []string{"automerge"}, + AllowedBranches: []string{"feature/*", "fix/*"}, + }, + }, + checkContains: []string{ + "GH_AW_SAFE_OUTPUTS_HANDLER_CONFIG", + }, + checkJSON: true, + expectedKeys: []string{"merge_pull_request"}, + }, } for _, tt := range tests {