Skip to content

If you use this repository, you can do CodeReview to Github PR using AWS's service Bedrock.

License

Notifications You must be signed in to change notification settings

eple0329/AWSBedrock-CodeReview

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bedrock CodeReview Bot

Translation 🇰🇷한국어 | ENGLISH

Overview

This is a Bot that performs CodeReview for Github PRs using Bedrock, one of the AWS services.

How To Use?

name: PR Review Bot

on:
  pull_request:
    types: [ opened, synchronize ]

permissions:
  pull-requests: write

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - name: AWS Bedrock Code Review Action
        uses: eple0329/AWSBedrock-CodeReview@latest
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: ${{ secrets.AWS_REGION }}
          github-token: ${{ secrets.GITHUB_TOKEN }} # Variable provided by default in Github
          # Optional
          model: 'amazon.titan-text-premier-v1:0' # Default: Anthropic Haiku
          max-tokens: 1000 # Default: 1000
          language: 'Korean' # Default: English
          prompt: "your Custom Prompt"

Permission

permissions:
  pull-requests: write
  • Write permission for pull-requests is mandatory.
  • Without this permission, you may encounter errors such as:
    • "Resource not accessible by integration"
    • "HttpError: 403 Forbidden"

Environments

  • aws-access-key-id, aws-secret-access-key

    • These are authentication credentials to access the AWS Bedrock service.
    • They are the access keys of a user created in AWS IAM (Identity and Access Management).
    • AWS_ACCESS_KEY_ID represents the ID of the access key, and AWS_SECRET_ACCESS_KEY represents the secret access key.
    • Minimum required permission for this account: bedrock:InvokeModel
    {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "InvokeModelAccess",
          "Effect": "Allow",
          "Action": "bedrock:InvokeModel",
          "Resource": "*"
        }
      ]
    }
  • aws-region

    • Specifies the region where AWS services will be used.
    • 'us-east-1', 'ap-northeast-3' etc...
    • Please use a region that supports the Bedrock service. (Reference)
  • github-token

    • This is an authentication token for using the GitHub API.
    • It uses the token automatically provided by GitHub Actions. (You don't need to add it to secrets.)
    • It's used for commenting on pull requests or updating statuses.

[Optional]

  • model

    • Specifies the AWS Bedrock model to use.
    • The default is Anthropic's Haiku model.
    • Currently available models are AWS Titan Text / Anthropic types.
      • Other models might be usable, but we can't guarantee as they haven't been tested.
  • language

    • Specifies the language of the code review response.
    • The default is English.
  • prompt

    • This is a custom prompt to be passed to the model.
    • You can specify the style, focus, and details of the code review.
    • For example, you can set it as "You are a senior backend engineer. Please review the following code changes and provide a detailed review in terms of security, performance, and readability."

Contributing

Do you have any suggestions for this project? We welcome proposals in all areas, including feature suggestions, bug reports, and documentation modifications!

Credit

This project was inspired by ChatGPT-CodeReview.

About

If you use this repository, you can do CodeReview to Github PR using AWS's service Bedrock.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages