Skip to content

feat: ACNA-4515 add pr-reviewer workflow#296

Merged
chsrimanaswi merged 7 commits into
masterfrom
ACNA-4515-Add-pr-reviewer-workflow
Apr 16, 2026
Merged

feat: ACNA-4515 add pr-reviewer workflow#296
chsrimanaswi merged 7 commits into
masterfrom
ACNA-4515-Add-pr-reviewer-workflow

Conversation

@chsrimanaswi

@chsrimanaswi chsrimanaswi commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a GitHub Actions workflow that automatically reviews pull requests using Claude via AWS Bedrock. Reviews are posted as inline comments by github-actions[bot], with support for re-triggering via /review or /pr-reviewer comments.

Related Issue

ACNA-4515

Motivation and Context

Reduces manual review toil on routine PRs. The bot catches common issues (error handling, security, code clarity) and re-raises unresolved suggestions on subsequent pushes, so nothing gets lost across review cycles.

How Has This Been Tested?

  • Triggered automatically on PR open/synchronize, confirmed review posted by github-actions[bot]
  • Verified fork PRs are blocked at the job-level if condition
  • Verified old bot reviews are dismissed when a new review is posted

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 PR Reviewer

The workflow is generally well-structured with a reasonable permission gate. However, there are security concerns around comment body matching and injection risks from unsanitized GitHub context values interpolated directly into shell commands. The gate logic also lacks explicit handling for the case where the allowed output is not set (e.g., on error), which could lead to unexpected behavior.

📝 5 suggestion(s) - Please review inline comments below.


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

Comment thread .github/workflows/pr-review.yml
Comment thread .github/workflows/pr-review.yml Outdated
Comment thread .github/workflows/pr-review.yml
Comment thread .github/workflows/pr-review.yml
Comment thread .github/workflows/pr-review.yml
@codecov

codecov Bot commented Apr 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 PR Reviewer

The diff addresses most previously raised injection and error-handling concerns: ISSUE_NUMBER and COMMENT_USER_LOGIN are now passed via env vars, and set -euo pipefail is present. A few issues remain, including the exact-match comment body check and direct interpolation of github.repository and github.event.pull_request.number/head.sha into shell strings.

📝 5 suggestion(s) (4 new, 1 re-raised)


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

Comment thread .github/workflows/pr-review.yml
Comment thread .github/workflows/pr-review.yml Outdated
Comment thread .github/workflows/pr-review.yml Outdated
Comment thread .github/workflows/pr-review.yml Outdated
Comment thread .github/workflows/pr-review.yml
@github-actions
github-actions Bot dismissed their stale review April 15, 2026 17:56

Superseded by new review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 PR Reviewer

Most of the previously raised security issues (script injection via direct interpolation of github context values) have been addressed by moving values to env vars. The comment body exact-match issue remains unaddressed and could silently fail for users who add trailing whitespace or use different casing. The permission check logic also only allows 'admin' and 'maintain', excluding 'write' collaborators, which may be intentional but is worth confirming.

📝 2 suggestion(s) (1 new, 1 re-raised)


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

Comment thread .github/workflows/pr-review.yml
Comment thread .github/workflows/pr-review.yml Outdated
@github-actions
github-actions Bot dismissed their stale review April 15, 2026 18:02

Superseded by new review

chsrimanaswi and others added 2 commits April 15, 2026 11:03
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 PR Reviewer

The workflow is generally well-structured with good use of environment variables to avoid injection, proper error handling with set -euo pipefail, and clear inline comments addressing previous review concerns. The two previously raised issues have been partially addressed: the permission check now has the clarifying comment, but the comment body comparison is still exact-match only (though a NOTE comment was added documenting this limitation rather than fixing it).

🔄 1 re-raised suggestion(s) from previous review


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

Comment thread .github/workflows/pr-review.yml
@github-actions
github-actions Bot dismissed their stale review April 15, 2026 18:06

Superseded by new review

@chsrimanaswi
chsrimanaswi dismissed github-actions[bot]’s stale review April 15, 2026 18:09

Exact match is intentional. startsWith('/review') would match any comment beginning with /review — including /review-this-please, /reviewer, or /review123, silently triggering the bot on unintended input. The known limitation (trailing whitespace, mixed case) is a minor UX inconvenience that users quickly learn; the injection surface from startsWith is a worse trade-off. Documenting it via the comment is sufficient.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤖 PR Reviewer

The workflow logic and security gate are well-structured, but the previously raised issue with exact comment body matching remains unaddressed. The NOTE comment documents the fragility without resolving it, and GitHub Actions expression functions (trim, toLower, startsWith) are available and should be used here.

🔄 1 re-raised suggestion(s) from previous review


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

Comment on lines +11 to +15
# NOTE: comment body matching is exact — /review or /pr-reviewer with no trailing spaces, newlines, or mixed case
if: |
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) ||
(github.event_name == 'issue_comment' && github.event.issue.pull_request != null &&
(github.event.comment.body == '/review' || github.event.comment.body == '/pr-reviewer'))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[Re-raised] The NOTE comment documents the exact-match limitation but does not fix it. Trailing whitespace, newlines (common when users submit comments), or mixed casing will silently fail. GitHub Actions supports startsWith(), toLower(), and trim() — use them to make matching robust.

Suggested change
# NOTE: comment body matching is exact — /review or /pr-reviewer with no trailing spaces, newlines, or mixed case
if: |
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) ||
(github.event_name == 'issue_comment' && github.event.issue.pull_request != null &&
(github.event.comment.body == '/review' || github.event.comment.body == '/pr-reviewer'))
# NOTE: comment body is trimmed and lowercased before matching to handle common whitespace/casing variations
if: |
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) ||
(github.event_name == 'issue_comment' && github.event.issue.pull_request != null &&
(startsWith(trim(toLower(github.event.comment.body)), '/review') || startsWith(trim(toLower(github.event.comment.body)), '/pr-reviewer')))

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Exact match is intentional. startsWith('/review') would match any comment beginning with /review including /review-this-please, /reviewer, or /review123, silently triggering the bot on unintended input. The known limitation (trailing whitespace, mixed case) is a minor UX inconvenience, the injection surface from startsWith is a worse trade-off. Documenting it via the comment is sufficient.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I encountered this in the template registry when I added "/update" and accidentally added a newline. Since it triggered the Github Action i left it for a while, not knowing that it skipped everything with no feedback. An annoyance, but I left it the same as you.

@chsrimanaswi
chsrimanaswi dismissed github-actions[bot]’s stale review April 15, 2026 20:49

Exact match is intentional. startsWith('/review') would match any comment beginning with /review including /review-this-please, /reviewer, or /review123, silently triggering the bot on unintended input. The known limitation (trailing whitespace, mixed case) is a minor UX inconvenience, the injection surface from startsWith is a worse trade-off. Documenting it via the comment is sufficient.

Comment on lines +11 to +15
# NOTE: comment body matching is exact — /review or /pr-reviewer with no trailing spaces, newlines, or mixed case
if: |
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) ||
(github.event_name == 'issue_comment' && github.event.issue.pull_request != null &&
(github.event.comment.body == '/review' || github.event.comment.body == '/pr-reviewer'))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I encountered this in the template registry when I added "/update" and accidentally added a newline. Since it triggered the Github Action i left it for a while, not knowing that it skipped everything with no feedback. An annoyance, but I left it the same as you.

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.

3 participants