UID2-7022: add Azure OpenAI automated PR code review (MVP)#629
Open
UID2-7022: add Azure OpenAI automated PR code review (MVP)#629
Conversation
681ebc1 to
47021d3
Compare
Adds an MVP workflow that posts a single, idempotently-updated PR comment containing an Azure OpenAI–generated code review. - .github/scripts/review_pr_diff.py — reads the unified diff from stdin, calls the configured Azure OpenAI deployment, writes a base64-encoded comment body to GITHUB_OUTPUT. Truncates oversized diffs and exits cleanly when the diff is empty or required env vars are missing. - .github/actions/comment_ai_review/action.yml — composite action that creates / updates / deletes a single comment matched by header marker. - .github/workflows/ai-code-review.yaml — pull_request + workflow_dispatch trigger; skips drafts and forks; concurrency-cancels superseded runs. Prerequisites: AZURE_OPENAI_API_KEY and AZURE_OPENAI_ENDPOINT must be provisioned for this repo (org or repo-level). Workflow no-ops cleanly if either is absent. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
47021d3 to
625893c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an MVP workflow that posts a single, idempotently-updated PR comment containing an Azure OpenAI–generated code review.
.github/scripts/review_pr_diff.py— reads the unified PR diff from stdin, calls the configured Azure OpenAI deployment with a code-review system prompt (correctness / security / error handling / test coverage), and writes a base64-encoded markdown comment body to$GITHUB_OUTPUT. Truncates diffs above 60k chars; exits cleanly when the diff is empty or required env vars are missing..github/actions/comment_ai_review/action.yml— composite action that creates, updates, or deletes a single PR comment keyed by the header marker## Azure OpenAI Code Review..github/workflows/ai-code-review.yaml—pull_request(opened,synchronize,reopened) +workflow_dispatchtrigger. Skips draft PRs and PRs from forks (forks don't get the secrets anyway). Concurrency group cancels superseded runs.Prerequisite — secret provisioning
Two repository (or org-level) secrets must be added to
IABTechLab/uid2-adminbefore the workflow can call Azure OpenAI:AZURE_OPENAI_API_KEYAZURE_OPENAI_ENDPOINTThe model deployment name defaults to
gpt-5and can be overridden via the optionalAZURE_OPENAI_DEPLOYMENTenv var if a different deployment is preferred.Until both secrets are provisioned, the workflow runs, logs
No review produced: AZURE_OPENAI_API_KEY is not set(or similar for the endpoint), and exits cleanly without posting a comment.Out of scope (intentionally deferred)
POST /repos/{owner}/{repo}/pulls/{pr}/reviews— needs hunk parsing and structured model output. Will revisit if the summary form earns its keep.Test plan
workflow_dispatchagainst an open PR and confirm a single## Azure OpenAI Code Reviewcomment is created.Related