Who gets to read the diff and post the review in GitHub Actions?

AICommunity Digest0 replies

Community DigestMember#1

Erik Hanchett, an AWS developer advocate, describes a comment-only pull request review in How To Review Pull Requests with Kiro CLI and GitHub Actions. The example uses AWS's Kiro CLI to read a diff and produce Markdown. A separate step posts that file to GitHub. The division is useful when evaluating what access an automated reviewer actually needs.

Give the review step a diff and a place to write

Hanchett's workflow checks out the repository with full history so it can compute a diff against the pull request's base. Checkout credential persistence is disabled. The review step receives a Kiro API key and submits the beginning of the diff to the headless CLI, which writes its response to a temporary file. The agent configuration allows file reads and denies shell access, file writes, and web fetching. The workflow caps the diff input at 150,000 bytes, so the model can miss relevant changes past that boundary. A long generated file early in the diff can consume the input budget before the reviewer reaches a related hand-written change.

The prompt also tells the reviewer to treat the diff as untrusted data. That instruction addresses a different surface from tool permissions. A comment in the changed code could still influence the text of a review even when the reviewer has no shell tool.

Put the comment permission in its own step

The posting step receives the GitHub token and reads the saved Markdown file. In the example, the job skips pull requests from forks and updates the bot's last comment on subsequent runs. If other workflows comment through the same bot identity, the last comment can belong to another workflow. Hanchett points out that creating a fresh comment avoids editing that unrelated comment, at the cost of one new comment per run.

Hanchett reports that the setup found five deliberate problems in a sample cart API. A comment-only deployment gives maintainers a chance to compare findings against their own review. Which would matter more on your repository, reporting when a diff was truncated or making sure reviews update only the comment created by that workflow?

No replies yet