New to Kestra?
Use blueprints to kickstart your first workflows.
Automatically review GitHub pull requests with OpenAI GPT-4o on Kestra. Fetch the diff, generate a structured, severity-rated review, and post it as a PR comment.
Automate first-pass GitHub pull request code review with OpenAI GPT-4o. This blueprint fetches the PR diff and metadata from the GitHub REST API, sends them to GPT-4o together with your custom coding guidelines, and posts a structured, severity-rated review back onto the pull request as a comment. It solves the bottleneck of slow, inconsistent, manual code review: every PR gets immediate, standards-aligned feedback before a human reviewer ever opens it, cutting review latency and enforcing the same rules on every change.
github_webhook trigger (io.kestra.plugin.core.trigger.Webhook) starts the flow on demand, secured by a webhook key, so GitHub Actions, an external CI step, or a manual call can launch a review.fetch_pr_diff (io.kestra.plugin.core.http.Request) calls the GitHub pulls/{number}/files endpoint to retrieve every changed file and its diff.fetch_pr_metadata (io.kestra.plugin.core.http.Request) pulls the PR title and description for additional context.generate_review (io.kestra.plugin.openai.ChatCompletion) sends the diff, metadata, and your review_guidelines input to GPT-4o (model: gpt-4o, maxTokens: 2000), which returns a Summary, severity-tagged Issues Found (CRITICAL, MAJOR, MINOR), Suggestions, and a final Verdict.post_review_comment (io.kestra.plugin.core.http.Request) POSTs the review to the GitHub Issues comments endpoint so it appears directly on the PR.GitHub and the OpenAI API have no shared scheduler that can chain diff retrieval, an LLM call, and a comment post into one observable, retryable pipeline. Kestra fills that gap: the event-driven Webhook trigger reacts to PR activity in real time, declarative YAML keeps the whole review logic version-controlled and reviewable, each HTTP and ChatCompletion task can carry independent retries against API rate limits or timeouts, and every execution is captured with inputs, outputs, and logs for full lineage and replay.
GITHUB_TOKEN: GitHub token used to read the PR diff and metadata and to post the review comment.OPENAI_API_KEY: OpenAI API key for the GPT-4o ChatCompletion call.WEBHOOK_KEY: secret value securing the webhook trigger URL.GITHUB_TOKEN, OPENAI_API_KEY, and WEBHOOK_KEY as secrets in your Kestra instance.repo_owner, repo_name, and pull_number inputs (or wire them into the webhook payload).review_guidelines input to match your team's standards.review_guidelines dynamically from a database, Git file, or Notion page.