Skip to content

ci: add AI code review workflow (Claude on Bedrock)#6053

Open
jam-jee wants to merge 1 commit into
aws:masterfrom
jam-jee:ai-code-review-claude-bedrock
Open

ci: add AI code review workflow (Claude on Bedrock)#6053
jam-jee wants to merge 1 commit into
aws:masterfrom
jam-jee:ai-code-review-claude-bedrock

Conversation

@jam-jee

@jam-jee jam-jee commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

What

Adds an automated AI code-review workflow (.github/workflows/ai-code-review.yml) that reviews PRs using anthropics/claude-code-action@v1 running on Amazon Bedrock.

This follows the same pattern already used by other public aws/* repos (e.g. aws/aws-workload-credentials-provider, aws/secrets-store-csi-driver-provider-aws, the Bedrock AgentCore SDKs).

Why Bedrock

  • Inference runs in-account via GitHub OIDC — no long-lived Anthropic API key.
  • Every InvokeModel call is CloudTrail-audited for cost attribution and security review.

Fork safety

The workflow uses pull_request_target (required to assume the Bedrock role and post comments), so it reuses the existing collaborator gate from pr-checks-master.yml:

  • Collaborator PRs → auto-approve environment (runs immediately).
  • Fork / external PRs → manual-approval environment (a maintainer must approve the run before any secret or the Bedrock role is exposed).

No new environments are introduced — auto-approve and manual-approval already exist on this repo.

Setup required before this is functional

This PR adds the workflow only. A maintainer must also:

  1. Enable Bedrock model access for us.anthropic.claude-opus-4-8 in the CI account/region (us-west-2).
  2. Create an OIDC IAM role with bedrock:InvokeModel, trust scoped to repo:aws/sagemaker-python-sdk:*, and store its ARN as the CODE_REVIEW_ROLE secret.
  3. COLLAB_CHECK_TOKEN is already used by existing workflows — no change needed.

Notes / open to feedback

  • Currently scoped (via paths:) to the sagemaker-train, sagemaker-serve, sagemaker-mlops, and sagemaker-core directories, mirroring pr-checks-master.yml. Remove that block to review every PR.
  • Posts as github-actions[bot] via GITHUB_TOKEN. Can switch to a dedicated GitHub App identity if preferred.
  • The review prompt is tuned for SDK concerns (public-interface/backward compatibility, credential handling, test coverage) and told to skip lint-enforced nits.

Raised for evaluation — happy to adjust triggers, scope, model, or prompt per maintainer preference.

Adds an automated PR review using anthropics/claude-code-action@v1 running
on Amazon Bedrock. Inference stays in-account and is CloudTrail-audited; no
external API key is required.

Reuses the existing collaborator gate from pr-checks-master.yml so that
collaborator PRs auto-run and fork/external PRs require manual approval
before any secret or the Bedrock role is exposed (safe under
pull_request_target).
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