{"id":16602429,"url":"https://github.com/lnxpy/revai","last_synced_at":"2025-10-29T13:32:04.595Z","repository":{"id":217090672,"uuid":"734734927","full_name":"lnxpy/revai","owner":"lnxpy","description":"💬 AI Automation Tool That Reviews PRs' Changed Files! (Made for @Hashnode X @mindsdb Hackathon)","archived":false,"fork":false,"pushed_at":"2024-03-18T20:03:53.000Z","size":522,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T01:51:14.307Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lnxpy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-22T13:20:48.000Z","updated_at":"2024-10-10T18:36:08.000Z","dependencies_parsed_at":"2024-01-14T14:30:22.467Z","dependency_job_id":"d22dffe8-5dc9-4080-88ff-eb51ebb0fdfb","html_url":"https://github.com/lnxpy/revai","commit_stats":null,"previous_names":["lnxpy/revai"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lnxpy%2Frevai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lnxpy%2Frevai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lnxpy%2Frevai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lnxpy%2Frevai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lnxpy","download_url":"https://codeload.github.com/lnxpy/revai/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238832351,"owners_count":19538272,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-12T00:22:09.498Z","updated_at":"2025-10-29T13:32:04.215Z","avatar_url":"https://github.com/lnxpy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"media/banner.svg\"\u003e\n\nAn AI code reviewing action that leaves its thoughts whenever someone opens a pull request on your repository. Let AI approve it, then just merge it!\n\n## Setup\nYou have to create a MindsDB account [here](https://cloud.mindsdb.com/login) and log into it. Then train a GPT model based on your desired prompt and share the credentials with RevAI so that it'll be able to comment on changes.\n\nOnce you've created the account, follow the steps here.\n\n### 1. Get an `API_KEY` from OpenAI\nCreate an account on [here](https://openai.com/) and generate a chatGPT access token. Copy that into your clipboard.\n\n### 2. Train the model\nNavigate to your [dashboard](https://cloud.mindsdb.com/home) and create a new instance. Execute the following snippet in your instance editor.\n\n\u003e Replace your OpenAI token with `\u003cYOUR-TOKEN\u003e`.\n\n```sql\nCREATE MODEL mindsdb.gpt_model\nPREDICT response\nUSING\nengine = 'openai',\napi_key = '\u003cYOUR-TOKEN\u003e',\nmodel_name = 'gpt-3.5-turbo', -- you can also use 'text-davinci-003' or 'gpt-3.5-turbo'\nprompt_template = 'review the {{text}} based on clean-code principles and pep rules then rate it from 1 to 10 and put it in the \"score\" field. Put your thoughts about it in one sentence in the \"message\" field.\n\nRespond with no formatting, but in the following structure:\n\n{\n    \"score\": int,\n    \"message\": str\n}'; \n```\n\n## Usage\nIn this step..\nNow, it's time to use RevAI and see the magic.\n\n### 1. Create comment template\nCreate `.github/comment-template.md` file and put the template you want RevAI to put its comments inside.\n\nYou can use the following example as your `comment-template.md`.\n```\n| 📂 **File**   | 💬 **Comment** | 🏆 **Score**    |\n| :-----------: |---------------| :-------------: |\n| `{{ .file }}` | {{ .message }} | {{ .score }}/10 |\n```\n\nAnd this is how it looks like when RevAI comments on your code.\n\n![Alt text](media/image.png)\n\n### 2. Create secrets\nNavigate to **Settings** \u003e **Secrets and variables** \u003e **Actions**. Click on **New repository secrets**. You need to add two secrets here. One should be named `EMAIL` that contains your MindsDB's account email and the other one is `PASSWORD` that contains your account's password.\n\n### 3. Create the CI pipeline\n\nPaste the following action workflow in `.github/workflows/review.yml`.\n\n```yml\nname: RevAI Reviewing\n\non:\n  pull_request:\n    branches:\n      - 'main'\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n\n    steps:\n      - name: Checking out\n        uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n\n      - name: Get changed files\n        id: changed-files\n        uses: tj-actions/changed-files@v41\n\n      - name: Use RevAI\n        id: revai\n        uses: lnxpy/revai@0.1.0\n        with:\n          email: ${{ secrets.EMAIL }}\n          password: ${{ secrets.PASSWORD }}\n          files: ${{ steps.changed-files.outputs.all_changed_files }}\n\n      - name: Render template\n        id: template\n        uses: chuhlomin/render-template@v1.4\n        with:\n          template: .github/comment-template.md\n          vars: |\n            file: ${{ steps.revai.outputs.file }}\n            message: ${{ steps.revai.outputs.message }}\n            score: ${{ steps.revai.outputs.score }}\n\n      - name: Create comment\n        uses: peter-evans/create-or-update-comment@v3\n        with:\n          issue-number: ${{ github.event.number }}\n          body: ${{ steps.template.outputs.result }}\n```\n\nNow, whenever someone opens a pull request on your repository, RevAI will review the codes and put comment on your change.\n\n## License\nCheck out [MIT License](LICENSE) terms.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flnxpy%2Frevai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flnxpy%2Frevai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flnxpy%2Frevai/lists"}