Skip to content
Prev Previous commit
Add AI code review to update-copilot-dependency workflow
  • Loading branch information
edburns committed Apr 17, 2026
commit 90f48325c104a4b40155c8dd3b48ecf637d4fedd
47 changes: 47 additions & 0 deletions .github/workflows/update-copilot-dependency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,53 @@ jobs:
working-directory: ./scripts/codegen
run: npm run generate

- uses: ./.github/actions/setup-copilot

- name: Verify generated code against schema
env:
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
run: |
cat > /tmp/verify-codegen-prompt.txt << 'PROMPT_EOF'
You are running inside the copilot-sdk-java repository.
The code generator has just run and produced Java source files under
src/generated/java/com/github/copilot/sdk/generated/rpc/.

Your task is to spot-check the generated API classes against the source
JSON schema to verify the generator produced correct output.

**Critical constraint: Do NOT modify any files. This is a read-only
verification. Use only read/inspect operations.**

**Steps:**
1. Read the API schema at:
scripts/codegen/node_modules/@github/copilot/schemas/api.schema.json

2. Pick these 3 generated API classes to verify:
- src/generated/java/com/github/copilot/sdk/generated/rpc/SessionToolsApi.java
- src/generated/java/com/github/copilot/sdk/generated/rpc/SessionUiApi.java
- src/generated/java/com/github/copilot/sdk/generated/rpc/SessionPermissionsApi.java

3. For each class, verify:
- Every RPC method in the schema's corresponding namespace has a
matching Java method in the generated class
- Parameter record fields match the JSON schema property names
- Java types are consistent with JSON schema types (String for
"string", Integer/int for "integer", Boolean/boolean for
"boolean", List for "array", Map or a generated class for
"object", etc.)
- No extra methods exist in the Java class that are not in the
schema

4. Print a summary table of what was checked and the result for each
method.

5. If ANY mismatch is found, print the details and exit with a
non-zero code.
If all checks pass, print "Schema verification passed" and exit 0.
PROMPT_EOF

copilot --yolo --prompt "$(cat /tmp/verify-codegen-prompt.txt)"

- name: Create pull request
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Loading