GithubHelp home page GithubHelp logo

llm-code-review-actions's Introduction

llm-code-review-actions

GitHub Actions for code review powered by LLM using Groq

Usage

Create action.yaml in your repository under .github/workflows directory with the following content:

name: code review

on: pull_request

jobs:
  review:
    permissions:
      contents: read
      pull-requests: write

    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Set up Go
        uses: actions/setup-go@v2

      - name: Generate diff
        uses: technote-space/get-diff-action@v6
        id: get-diff

      - name: Save diff
        if: steps.get-diff.outputs.diff
        run: |
          git fetch origin ${{ github.event.pull_request.base.ref }}
          git diff origin/${{ github.event.pull_request.base.ref }} -- . ':!vendor' ':!go.mod' ':!go.sum' > diff.txt

      - name: Review
        if: steps.get-diff.outputs.diff
        uses: Kcrong/llm-code-review-actions@init
        with:
          groq_api_key: ${{ secrets.GROQ_API_KEY }}
          diff_file: diff.txt

PR Comments

You will be able to see the comments on the PRs like this:

Update Prompt

Refer to pkg/prompt/looking_for.go

package prompt

// Ref) https://google.github.io/eng-practices/review/reviewer/looking-for.html

const CodeReviewRulePrompt = `
You are a code reviewer. When a user provides their code diff, you should write a PR review according to the given PR review guidelines. The code review should be written as a single comment and follow the markdown format.

What to look for in a code review
Note: Always make sure to take into account The Standard of Code Review when considering each of these points.

Design
The most important thing to cover in a review is the overall design of the CL. Do the interactions of various pieces of code in the CL make sense? Does this change belong in your codebase, or in a library? Does it integrate well with the rest of your system? Is now a good time to add this functionality?

Functionality
Does this CL do what the developer intended? Is what the developer intended good for the users of this code? The “users” are usually both end-users (when they are affected by the change) and developers (who will have to “use” this code in the future).

...

llm-code-review-actions's People

Contributors

kcrong avatar

Stargazers

 avatar

Watchers

 avatar

llm-code-review-actions's Issues

[@magicx-ai] Delete vendor.

magicx-ai/groq-go is private for now, we need to keep vendor until it's public.

// TODO(@magicx-ai): Delete vendor.

	"strings"

	"github.com/google/go-github/github"
	"github.com/pkg/errors"
	"golang.org/x/oauth2"

	"github.com/magicx-ai/groq-code-review-actions/pkg/prompt"
	// TODO(@magicx-ai): Delete vendor.
	// magicx-ai/groq-go is private for now, we need to keep vendor until it's public.
	"github.com/magicx-ai/groq-go/groq"
)

const (

[@Kcrong] Delete vendor.

magicx-ai/groq-go is private for now, we need to keep vendor until it's public.

// TODO(@Kcrong): Delete vendor.

	"github.com/pkg/errors"
	"golang.org/x/oauth2"

	"github.com/Kcrong/llm-code-review-actions/pkg/prompt"
	// TODO(@Kcrong): Delete vendor.
	// magicx-ai/groq-go is private for now, we need to keep vendor until it's public.
	"github.com/magicx-ai/groq-go/groq"
)

[@Kcrong] Delete vendor.

magicx-ai/groq-go is private for now, we need to keep vendor until it's public.

https://github.com/Kcrong/groq-code-review-actions/blob/9ac4f8a3efd07ac2cdaa078ad0ff2ce02d2c313b/cmd/main.go#L14

	"strings"

	"github.com/google/go-github/github"
	// TODO(@Kcrong): Delete vendor.
	// magicx-ai/groq-go is private for now, we need to keep vendor until it's public.
	"github.com/magicx-ai/groq-go/groq"
	"github.com/pkg/errors"
	"golang.org/x/oauth2"

	"github.com/Kcrong/groq-code-review-actions/pkg/prompt"
)

const (

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.