Skip to content

Commit 90f4832

Browse files
committed
Add AI code review to update-copilot-dependency workflow
1 parent 0946fc5 commit 90f4832

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/update-copilot-dependency.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,53 @@ jobs:
5151
working-directory: ./scripts/codegen
5252
run: npm run generate
5353

54+
- uses: ./.github/actions/setup-copilot
55+
56+
- name: Verify generated code against schema
57+
env:
58+
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
59+
run: |
60+
cat > /tmp/verify-codegen-prompt.txt << 'PROMPT_EOF'
61+
You are running inside the copilot-sdk-java repository.
62+
The code generator has just run and produced Java source files under
63+
src/generated/java/com/github/copilot/sdk/generated/rpc/.
64+
65+
Your task is to spot-check the generated API classes against the source
66+
JSON schema to verify the generator produced correct output.
67+
68+
**Critical constraint: Do NOT modify any files. This is a read-only
69+
verification. Use only read/inspect operations.**
70+
71+
**Steps:**
72+
1. Read the API schema at:
73+
scripts/codegen/node_modules/@github/copilot/schemas/api.schema.json
74+
75+
2. Pick these 3 generated API classes to verify:
76+
- src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsApi.java
77+
- src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiApi.java
78+
- src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsApi.java
79+
80+
3. For each class, verify:
81+
- Every RPC method in the schema's corresponding namespace has a
82+
matching Java method in the generated class
83+
- Parameter record fields match the JSON schema property names
84+
- Java types are consistent with JSON schema types (String for
85+
"string", Integer/int for "integer", Boolean/boolean for
86+
"boolean", List for "array", Map or a generated class for
87+
"object", etc.)
88+
- No extra methods exist in the Java class that are not in the
89+
schema
90+
91+
4. Print a summary table of what was checked and the result for each
92+
method.
93+
94+
5. If ANY mismatch is found, print the details and exit with a
95+
non-zero code.
96+
If all checks pass, print "Schema verification passed" and exit 0.
97+
PROMPT_EOF
98+
99+
copilot --yolo --prompt "$(cat /tmp/verify-codegen-prompt.txt)"
100+
54101
- name: Create pull request
55102
env:
56103
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)