Skip to content

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

Merged
chsrimanaswi merged 1 commit into
masterfrom
ACNA-4515-Add-pr-reviewer-workflow
Apr 27, 2026
Merged

feat: ACNA-4515 add pr-reviewer workflow#142
chsrimanaswi merged 1 commit into
masterfrom
ACNA-4515-Add-pr-reviewer-workflow

Conversation

@chsrimanaswi

Copy link
Copy Markdown
Contributor

Description

Adds an AI-powered PR reviewer workflow that automatically reviews pull requests using Claude via AWS Bedrock. Triggers on PR open/reopen/synchronize and on /review or /pr-reviewer comments by admins or maintainers.

Related Issue

ACNA-4515

Motivation and Context

Reduces code review toil by providing automated first-pass reviews with inline suggestions. Part of a broader rollout across App Builder repos.

How Has This Been Tested?

Tested end-to-end in adobe/generator-aio-app — workflow triggers correctly on PR events and /review comments, posts inline suggestions and summary reviews via github-actions[bot].

Screenshots (if appropriate):

N/A

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

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 well-structured with clear security gating and good use of environment variables to avoid injection. Two minor but meaningful issues exist: a potential injection risk with GITHUB_REPOSITORY in the shell command, and the missing write permission for pull-request comments which may be needed depending on what the reusable workflow does.

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


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

# Intentionally require admin or maintain; write collaborators are excluded to
# limit who can trigger potentially expensive/sensitive review automation.
if [ "$PERM" = "admin" ] || [ "$PERM" = "maintain" ]; then
DATA=$(gh api repos/$GITHUB_REPOSITORY/pulls/$ISSUE_NUMBER)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

GITHUB_REPOSITORY is injected directly into the shell string via variable expansion inside a double-quoted gh api call. While GitHub sets this automatically and it's not user-controlled, best practice is to pass it via an env var and reference it consistently (already done for COMMENT_USER_LOGIN and ISSUE_NUMBER). More critically, the gh api repos/$GITHUB_REPOSITORY/pulls/$ISSUE_NUMBER call on line 37 uses GITHUB_REPOSITORY directly from the environment rather than from the sanitized env block, which is inconsistent. Use the env var pattern already established.

Suggested change
DATA=$(gh api repos/$GITHUB_REPOSITORY/pulls/$ISSUE_NUMBER)
DATA=$(gh api "repos/${GITHUB_REPOSITORY}/pulls/${ISSUE_NUMBER}")

check:
# NOTE: comment body matching is exact — /review or /pr-reviewer with no trailing spaces, newlines, or mixed case
# This does not fail the workflow; non-matching comments simply do not trigger the job
if: |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The workflow lacks explicit permissions declarations. For a security-sensitive gating workflow that calls gh api and passes a token to a reusable workflow, explicitly declaring minimum required permissions (e.g., contents: read, pull-requests: read) at the job or workflow level is a best practice to follow the principle of least privilege and makes the security surface area clear.

Suggested change
if: |
permissions:
contents: read
pull-requests: read

@codecov

codecov Bot commented Apr 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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

Proposed changes not required

@chsrimanaswi chsrimanaswi merged commit f75f422 into master Apr 27, 2026
11 checks passed
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