Skip to content

Commit f83b711

Browse files
Copilotpelikhan
andcommitted
Update all test files to use on.roles and on.bots format
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 199bbe9 commit f83b711

11 files changed

+43
-74
lines changed

pkg/workflow/compiler_orchestrator_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,12 +608,13 @@ func TestExtractAdditionalConfigurations(t *testing.T) {
608608
tmpDir := testutil.TempDir(t, "additional-configs")
609609

610610
testContent := `---
611-
on: push
611+
on:
612+
push: null
613+
roles:
614+
- admin
615+
bots:
616+
- copilot
612617
engine: copilot
613-
roles:
614-
- admin
615-
bots:
616-
- copilot
617618
---
618619
619620
# Test Workflow

pkg/workflow/compiler_orchestrator_workflow_test.go

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,46 +1098,13 @@ on:
10981098
pull_request:
10991099
types: [opened, synchronize]
11001100
draft: false
1101+
roles:
1102+
- admin
1103+
- maintainer
1104+
bots:
1105+
- copilot
1106+
- dependabot
11011107
engine: copilot
1102-
name: Complete Workflow
1103-
description: Test all sections
1104-
source: complete-test
1105-
timeout-minutes: 60
1106-
strict: false
1107-
features:
1108-
dangerous-permissions-write: true
1109-
permissions:
1110-
contents: read
1111-
issues: write
1112-
pull-requests: write
1113-
network:
1114-
allowed:
1115-
- github.com
1116-
- api.example.com
1117-
concurrency:
1118-
group: ci-${{ github.ref }}
1119-
cancel-in-progress: true
1120-
run-name: Test Run ${{ github.run_id }}
1121-
env:
1122-
NODE_ENV: production
1123-
DEBUG: "true"
1124-
if: github.event_name == 'push'
1125-
runs-on: ubuntu-latest
1126-
environment: production
1127-
container: node:18
1128-
cache:
1129-
- key: ${{ runner.os }}-node
1130-
path: node_modules
1131-
tools:
1132-
bash: ["echo", "ls", "cat"]
1133-
github:
1134-
allowed: [list_issues, create_issue]
1135-
roles:
1136-
- admin
1137-
- maintainer
1138-
bots:
1139-
- copilot
1140-
- dependabot
11411108
steps:
11421109
- name: Custom step
11431110
run: echo "test"

pkg/workflow/permission_restriction_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ Test workflow content.`,
6767
on:
6868
push:
6969
branches: [main]
70-
roles: all
70+
roles: all
7171
tools:
7272
github:
7373
allowed: [list_issues]
@@ -85,7 +85,7 @@ Test workflow content.`,
8585
on:
8686
pull_request:
8787
types: [opened]
88-
roles: [admin, maintainer, write]
88+
roles: [admin, maintainer, write]
8989
tools:
9090
github:
9191
allowed: [list_issues]
@@ -101,8 +101,8 @@ Test workflow content.`,
101101
name: "workflow with workflow_dispatch only should NOT include permission check (safe event)",
102102
frontmatter: `---
103103
on:
104-
workflow_dispatch:
105-
roles: [admin, maintainer, write]
104+
workflow_dispatch: null
105+
roles: [admin, maintainer, write]
106106
tools:
107107
github:
108108
allowed: [list_issues]
@@ -118,8 +118,8 @@ Test workflow content.`,
118118
name: "workflow with workflow_dispatch without write role should include permission check",
119119
frontmatter: `---
120120
on:
121-
workflow_dispatch:
122-
roles: [admin, maintainer]
121+
workflow_dispatch: null
122+
roles: [admin, maintainer]
123123
tools:
124124
github:
125125
allowed: [list_issues]
@@ -190,8 +190,8 @@ Test workflow content.`,
190190
on:
191191
command:
192192
name: scout
193-
workflow_dispatch:
194-
roles: [admin, maintainer, write]
193+
workflow_dispatch: null
194+
roles: [admin, maintainer, write]
195195
tools:
196196
github:
197197
allowed: [list_issues]

pkg/workflow/pre_activation_custom_fields_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ func TestPreActivationCustomSteps(t *testing.T) {
2222
t.Run("custom_steps_imported", func(t *testing.T) {
2323
workflowContent := `---
2424
on:
25-
workflow_dispatch:
25+
workflow_dispatch: null
2626
stop-after: "+48h"
27+
roles: [admin, maintainer]
2728
engine: claude
28-
roles: [admin, maintainer]
2929
jobs:
3030
pre-activation:
3131
steps:
@@ -74,10 +74,10 @@ Test workflow with custom pre-activation steps
7474
t.Run("custom_outputs_imported", func(t *testing.T) {
7575
workflowContent := `---
7676
on:
77-
workflow_dispatch:
77+
workflow_dispatch: null
7878
stop-after: "+48h"
79+
roles: [admin, maintainer]
7980
engine: claude
80-
roles: [admin, maintainer]
8181
jobs:
8282
pre-activation:
8383
outputs:
@@ -121,8 +121,8 @@ Test workflow with custom pre-activation outputs
121121
on:
122122
workflow_dispatch:
123123
stop-after: "+48h"
124+
roles: [admin, maintainer]
124125
engine: claude
125-
roles: [admin, maintainer]
126126
jobs:
127127
pre-activation:
128128
steps:
@@ -168,8 +168,8 @@ Test workflow with both custom steps and outputs
168168
on:
169169
workflow_dispatch:
170170
stop-after: "+48h"
171+
roles: [admin, maintainer]
171172
engine: claude
172-
roles: [admin, maintainer]
173173
jobs:
174174
pre-activation:
175175
runs-on: ubuntu-latest
@@ -201,8 +201,8 @@ Test workflow with unsupported field in pre-activation
201201
on:
202202
workflow_dispatch:
203203
stop-after: "+48h"
204+
roles: [admin, maintainer]
204205
engine: claude
205-
roles: [admin, maintainer]
206206
jobs:
207207
pre-activation:
208208
steps:
@@ -255,8 +255,8 @@ Test that pre-activation is not added as a custom job
255255
on:
256256
workflow_dispatch:
257257
stop-after: "+48h"
258+
roles: [admin, maintainer]
258259
engine: claude
259-
roles: [admin, maintainer]
260260
jobs:
261261
pre-activation:
262262
steps:

pkg/workflow/processing_benchmark_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,9 @@ func BenchmarkProcessRoles(b *testing.B) {
288288
defer os.RemoveAll(tmpDir)
289289

290290
testContent := `---
291-
on: issues
292-
roles: [admin, maintainer, write, read]
291+
on:
292+
issues: null
293+
roles: [admin, maintainer, write, read]
293294
permissions:
294295
contents: read
295296
issues: write

pkg/workflow/role_checks_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ on:
115115
pull_request:
116116
types: [opened]
117117
roles: [write]
118-
bots: ["dependabot[bot]"]
118+
bots: ["dependabot[bot]"]
119119
---
120120
121121
# Test Workflow

pkg/workflow/skip_bots_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ on:
133133
issues:
134134
types: [opened]
135135
skip-bots: [user1, user2]
136-
roles: [maintainer]
136+
roles: [maintainer]
137137
engine: copilot
138138
---
139139

pkg/workflow/skip_if_match_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ This workflow has a skip-if-match configuration.
8787
t.Run("pre_activation_job_with_multiple_checks", func(t *testing.T) {
8888
workflowContent := `---
8989
on:
90-
workflow_dispatch:
90+
workflow_dispatch: null
9191
stop-after: "+48h"
9292
skip-if-match: "is:pr is:open"
93-
roles: [admin, maintainer]
93+
roles: [admin, maintainer]
9494
engine: claude
9595
---
9696

pkg/workflow/skip_if_no_match_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ This workflow has a skip-if-no-match configuration.
9292
t.Run("pre_activation_job_with_multiple_checks", func(t *testing.T) {
9393
workflowContent := `---
9494
on:
95-
workflow_dispatch:
95+
workflow_dispatch: null
9696
stop-after: "+48h"
9797
skip-if-no-match: "is:pr is:open label:urgent"
98-
roles: [admin, maintainer]
98+
roles: [admin, maintainer]
9999
engine: claude
100100
---
101101

pkg/workflow/stop_time_check_job_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ func TestPreActivationJob(t *testing.T) {
2222
t.Run("pre_activation_job_created_with_stop_after", func(t *testing.T) {
2323
workflowContent := `---
2424
on:
25-
workflow_dispatch:
25+
workflow_dispatch: null
2626
stop-after: "+48h"
27-
roles: [admin, maintainer]
27+
roles: [admin, maintainer]
2828
engine: claude
2929
---
3030
@@ -105,9 +105,9 @@ This workflow has a stop-after configuration.
105105
t.Run("no_pre_activation_job_without_stop_after_or_roles", func(t *testing.T) {
106106
workflowContent := `---
107107
on:
108-
workflow_dispatch:
108+
workflow_dispatch: null
109+
roles: all
109110
engine: claude
110-
roles: all
111111
---
112112
113113
# Normal Workflow

0 commit comments

Comments
 (0)