Skip to content

ci: adopt klein-cli AI review workflow - #33

Merged
fpt merged 1 commit into
mainfrom
add-ai-review-workflow
Jul 18, 2026
Merged

fpt merged 1 commit into
mainfrom
add-ai-review-workflow

Conversation

@fpt

@fpt fpt commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

Adopt klein-cli's AI code-review workflow by delegating to its published reusable workflow (fpt/klein-cli/.github/workflows/ai-review-reusable.yml@main).

On every PR (opened/synchronize/reopened) it runs klein review over the diff and posts a single sticky summary comment plus inline review comments. Reviews are stateful — incremental on later pushes, no-op rebases skipped, verified-fixed threads resolved.

  • Backend: openai, language: en
  • Gated to same-repo PRs (head.repo.full_name == github.repository), so fork PRs are skipped and never see the API-key secret.

Setup required

Add the OPENAI_API_KEY secret to the repo for the workflow to run:

gh secret set OPENAI_API_KEY --repo fpt/go-dev-mcp

🤖 Generated with Claude Code

Add an AI code-review workflow that delegates to klein-cli's published
reusable workflow (fpt/klein-cli/.github/workflows/ai-review-reusable.yml).
Runs klein review over each PR diff and posts a sticky summary plus inline
comments. Gated to same-repo PRs so fork PRs never see the API-key secret.

Requires the OPENAI_API_KEY repo secret.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

🤖 AI Review (klein) — turn 1

This adds a pull-request-triggered job that delegates review to an external reusable workflow and correctly limits execution to same-repository heads, while granting the workflow the API key and pull-request write permission it needs. The external workflow is referenced by the mutable main branch, however; because it runs with a repository secret and write access, upstream changes or compromise can execute privileged behavior in this repository. Pinning the dependency to a reviewed commit SHA is required before relying on this automation.


turn 1 (full review of 1ce976e) · comments: total 1, active 1 (+1 new, −0 resolved) · verdict: request_changes

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

klein AI review — details in the summary comment.

jobs:
review:
if: github.event.pull_request.head.repo.full_name == github.repository
uses: fpt/klein-cli/.github/workflows/ai-review-reusable.yml@main

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[major] Pin the reusable workflow to an immutable commit SHA (and update that SHA deliberately, ideally with an automated dependency-update process) instead of @main.

Rationale

Verified this is the only implementation of the new review job, and it receives OPENAI_API_KEY plus pull-requests: write. Because @main is mutable, a change or compromise in the external repository can alter the workflow that runs with this repository's secret and write token, allowing secret exfiltration or unauthorized PR mutations without any change here.

@fpt
fpt merged commit 8e9cc60 into main Jul 18, 2026
2 checks passed
@fpt
fpt deleted the add-ai-review-workflow branch July 18, 2026 01:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant