A code reviewer github action powered by AI, ready to be used in your workflow.
Create a workflow file inside .github/workflows folder (create if it doesn’t exist) of your repository with the following content:
name: Code Review
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
branches:
- main # change this to your target branch
workflow_dispatch: # Allows you to run the workflow manually from the Actions tab
permissions: # necessary permissions
pull-requests: write
contents: read
jobs:
your-job-name:
runs-on: ubuntu-latest
name: your-job-name
steps:
- name: step-name
id: step-id
uses: murtuzaalisurti/better@v3 # this is the ref of the github action - https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#jobsjob_iduses
with:
repo-token: $ # this is auto generated
ai-model-api-key: $ # make sure to set this in your repository secrets - /settings/secrets/actions (Settings > Secrets and Variables > Actions > Secrets Tab)
platform: 'openai' # can be 'openai' | 'anthropic' | 'google' | 'openrouter' | 'mistral'
delete-existing-review-by-bot: true #default is true
filesToIgnore: '**/*.env; .husky/**; .cache/**' # uses glob patterns (micromatch - https://github.com/micromatch/micromatch)
rules: |- # Rules to consider for code review
-- It must follow industry standard best practices
-- It should be idiomatic
-- It should be readable
-- It should not contain any security related vulnerabilities
-- It should not contain any sensitive data
-- It should be well structured
-- It should not contain bad patterns
[!NOTE] The
usesfield refers to which github action to use and what’s its reference. For example:murtuzaalisurti/better@mainmeans it refers to themainbranch of themurtuzaalisurti/betteraction. If you want to refer to a specific release or tag, you can specifymurtuzaalisurti/better@v1.0.0which means it refers to thev1.0.0of themurtuzaalisurti/betteraction.
Go to your repository settings, Settings > Secrets and Variables > Actions > Secrets Tab and add your platform API key. For example, add OPEN_AI_KEY as a secret with your OpenAI API key as a value. You can refer to it in the workflow file using $ against the ai-model-api-key field.

Settings > Actions > General > Actions Permissions Tab and select Allow all actions and reusable workflows.
Run the workflow by raising a pull request to the target branch mentioned in the on section in the workflow.
repo-tokenThe repo-token is the authorization token of your repository. It is auto generated by GitHub on every workflow run.
platformThe platform is the name of the AI platform you want to use. It can be either openai or anthropic or google or mistral or openrouter.
This action supports *OpenAI, Anthropic, Gemini, Mistral and Deepseek models*.
ai-model-api-keyThe ai-model-api-key is your platform’s API key which you have set in your repository secrets.
Example:
OPEN_AI_KEY as a secret with your OpenAI API key as a value.ANTHROPIC_KEY as a secret with your Anthropic API key as a value.MISTRAL_KEY as a secret with your Mistral API key as a value.OPENROUTER_KEY as a secret with your OpenRouter API key as a value.GOOGLE_API_KEY as a secret with your Google Gemini API key as a value.They can be accessed in the workflow file using $.
ai-model-name (Optional)Specify the name of the model you want to use to generate suggestions. Fallbacks to gpt-5 for OpenAI, claude-3-7-sonnet-latest for Anthropic, gemini-2.5-pro-preview-06-05 for Google’s Gemini, pixtral-12b-2409 for Mistral, and google/gemini-2.5-pro-preview-06-05 for OpenRouter if not specified. Here’s a list of supported models:
For OpenAI:
gpt-4o-mini-2024-07-18 and latergpt-4o-2024-08-06 and laterThis project uses Structured Outputs and that’s why only the above listed models are supported. More info here.
For Anthropic:
claude-3-7-sonnet-20250219claude-3-5-sonnet-20241022claude-3-5-sonnet-20240620claude-3-opus-20240229claude-3-sonnet-20240229claude-3-haiku-20240307For Mistral:
For OpenRouter:
structured outputs/response_format.For Google:
delete-existing-review-by-bot (Optional)By default, the action will delete any existing review(s) by the bot before creating a new one on every PR push. If you want to keep them, set this option to false.
rules (Optional)The rules to consider for code review. It is a multiline text field. Each rule should be on a new line and should start with --.
filesToIgnore (Optional)List of files to ignore. It is a semicolon(;) separated list of glob patterns. The default list of ignored files is:
**/node_modules/**
**/package-lock.json
**/yarn.lock
.cache/**
**/*.{jpg,jpeg,png,svg,webp,avif,gif,ico,woff,woff2,ttf,otf}
Glob patterns are resolved using micromatch. Check out their documentation for more info.
max-retries (Optional)The maximum number of retries the action will perform on failure while generating suggestions from the AI model. Specify 0 to skip retries (see things to note below to know why this is important). The default value is 3 if you don’t specify.
max-retries option in your workflow file. This will increase the consumption of tokens, so if you don’t want to retry on failure, set the max-retries option to 0.Made with ❤️ by @murtuzaalisurti. Learn more at https://syntackle.com/blog/ai-powered-code-review-tool-better/.