Skip to content

Commit 5cb9ec0

Browse files
github-actions[bot]Copilotpelikhan
authored
Add missing safe-output test workflows and Go compiler tests (#21427)
Add test workflows and Go compiler tests for 15 safe-output types that lacked test coverage in pkg/cli/workflows/ and compiler_safe_outputs_config_test.go. New test workflow files: - test-copilot-create-discussion.md - test-copilot-close-issue.md - test-copilot-submit-pull-request-review.md - test-copilot-reply-to-pull-request-review-comment.md - test-copilot-resolve-pull-request-review-thread.md - test-copilot-create-code-scanning-alerts.md - test-copilot-remove-labels.md - test-copilot-update-pull-request.md - test-copilot-update-project.md - test-copilot-create-project.md - test-copilot-create-project-status-update.md - test-copilot-link-sub-issue.md - test-copilot-dispatch-workflow.md - test-copilot-call-workflow.md - test-copilot-missing-data.md New Go test cases in TestAddHandlerManagerConfigEnvVar: - submit_pull_request_review config - reply_to_pull_request_review_comment config - resolve_pull_request_review_thread config - create_code_scanning_alert config - remove_labels config - update_pull_request config - update_project config - create_project config - create_project_status_update config - link_sub_issue config - dispatch_workflow config Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: Peli de Halleux <pelikhan@users.noreply.github.com>
1 parent fc23139 commit 5cb9ec0

16 files changed

Lines changed: 502 additions & 0 deletions
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
on:
3+
workflow_dispatch:
4+
permissions:
5+
contents: read
6+
actions: read
7+
engine: copilot
8+
safe-outputs:
9+
call-workflow:
10+
max: 1
11+
workflows:
12+
- test-copilot-noop
13+
---
14+
15+
# Test Copilot Call Workflow
16+
17+
Test the `call_workflow` safe output type with the Copilot engine.
18+
19+
## Task
20+
21+
Call the reusable workflow "test-copilot-noop" as a fan-out job.
22+
23+
Output results in JSONL format using the `call_workflow` tool.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
on:
3+
workflow_dispatch:
4+
permissions:
5+
contents: read
6+
issues: read
7+
engine: copilot
8+
safe-outputs:
9+
close-issue:
10+
max: 1
11+
---
12+
13+
# Test Copilot Close Issue
14+
15+
Test the `close_issue` safe output type with the Copilot engine.
16+
17+
## Task
18+
19+
Close issue #1 with a reason of "completed" and a comment "Closing this issue as it has been resolved by the automated test workflow."
20+
21+
Output results in JSONL format using the `close_issue` tool.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
on:
3+
workflow_dispatch:
4+
permissions:
5+
contents: read
6+
security-events: read
7+
engine: copilot
8+
safe-outputs:
9+
create-code-scanning-alerts:
10+
driver: Test Scanner
11+
max: 3
12+
timeout-minutes: 5
13+
---
14+
15+
# Test Copilot Create Code Scanning Alerts
16+
17+
Test the `create_code_scanning_alert` safe output type with the Copilot engine.
18+
19+
## Task
20+
21+
Create a code scanning alert with the following details:
22+
- **rule_id**: "TEST001"
23+
- **rule_description**: "Test security rule for automated testing"
24+
- **message**: "Found a potential test vulnerability"
25+
- **path**: "src/test.js"
26+
- **start_line**: 42
27+
- **severity**: "warning"
28+
29+
Output results in JSONL format using the `create_code_scanning_alert` tool.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
on:
3+
workflow_dispatch:
4+
permissions:
5+
contents: read
6+
engine: copilot
7+
safe-outputs:
8+
create-discussion:
9+
max: 1
10+
category: general
11+
---
12+
13+
# Test Copilot Create Discussion
14+
15+
Test the `create_discussion` safe output type with the Copilot engine.
16+
17+
## Task
18+
19+
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."
20+
21+
Output results in JSONL format using the `create_discussion` tool.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
on:
3+
workflow_dispatch:
4+
permissions:
5+
contents: read
6+
issues: read
7+
engine: copilot
8+
safe-outputs:
9+
create-project-status-update:
10+
max: 1
11+
---
12+
13+
# Test Copilot Create Project Status Update
14+
15+
Test the `create_project_status_update` safe output type with the Copilot engine.
16+
17+
## Task
18+
19+
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."
20+
21+
Output results in JSONL format using the `create_project_status_update` tool.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
on:
3+
workflow_dispatch:
4+
permissions:
5+
contents: read
6+
issues: read
7+
engine: copilot
8+
safe-outputs:
9+
create-project:
10+
max: 1
11+
---
12+
13+
# Test Copilot Create Project
14+
15+
Test the `create_project` safe output type with the Copilot engine.
16+
17+
## Task
18+
19+
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."
20+
21+
Output results in JSONL format using the `create_project` tool.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
on:
3+
workflow_dispatch:
4+
permissions:
5+
contents: read
6+
actions: read
7+
engine: copilot
8+
safe-outputs:
9+
dispatch-workflow:
10+
max: 1
11+
workflows:
12+
- test-copilot-noop
13+
---
14+
15+
# Test Copilot Dispatch Workflow
16+
17+
Test the `dispatch_workflow` safe output type with the Copilot engine.
18+
19+
## Task
20+
21+
Dispatch the workflow "test-copilot-noop" with no additional inputs.
22+
23+
Output results in JSONL format using the `dispatch_workflow` tool.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
on:
3+
workflow_dispatch:
4+
permissions:
5+
contents: read
6+
issues: read
7+
engine: copilot
8+
safe-outputs:
9+
link-sub-issue:
10+
max: 5
11+
---
12+
13+
# Test Copilot Link Sub-Issue
14+
15+
Test the `link_sub_issue` safe output type with the Copilot engine.
16+
17+
## Task
18+
19+
Link issue #2 as a sub-issue of issue #1. This establishes a parent-child relationship between the two issues.
20+
21+
Output results in JSONL format using the `link_sub_issue` tool.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
on:
3+
workflow_dispatch:
4+
permissions:
5+
contents: read
6+
actions: read
7+
issues: read
8+
pull-requests: read
9+
engine: copilot
10+
safe-outputs:
11+
missing-data:
12+
max: 5
13+
timeout-minutes: 5
14+
---
15+
16+
# Test Copilot Missing Data
17+
18+
Test the `missing_data` safe output type with the Copilot engine.
19+
20+
## Task
21+
22+
Report missing data with transparency messages about the following:
23+
- "Required issue number not found in the workflow trigger context"
24+
- "Expected pull request branch name but no PR was associated with this run"
25+
- "Configuration file 'config.json' not found in the repository root"
26+
27+
Output results in JSONL format using the `missing_data` tool.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
on:
3+
workflow_dispatch:
4+
permissions:
5+
contents: read
6+
issues: read
7+
engine: copilot
8+
safe-outputs:
9+
remove-labels:
10+
max: 5
11+
---
12+
13+
# Test Copilot Remove Labels
14+
15+
Test the `remove_labels` safe output type with the Copilot engine.
16+
17+
## Task
18+
19+
Remove the label "bug" from issue #1.
20+
21+
Output results in JSONL format using the `remove_labels` tool.

0 commit comments

Comments
 (0)