Skip to content

Integrate qodo AI Code Review in Github Action

Background

Background: I wrote notes and blogs regularly to record my thoughts and experiences. However, I found due to my carelles I wrote some typos, either Chinese or English, and I was aware this when I read them later. This is a painpoint for me so I would like to find a workflow to tackle it.

I first try to find a specialize spell check for both Chinese and English but failed, as a result, I try to integrate AI code review by qodo-ai/pr-agent in my github action.

Setup Github Action

Here are my github action configuration file but there are some pitfalls:

  • write the permissions field as it will update the pull request.
  • fork the qodo-ai/pr-agent otherwise github action doesn't allow you to use it.
  • use OPENAI.API_BASE to specify custom openai like domain. The docs is wrong.
  • use OPENAI_KEY to specify the api key, the docs suggested to use OPENAI__KEY rather than OPENAI_KEY doesn't take effect.

Besides the configuration file, you need to add action secret for OPENAI__KEY in github repository setting up page.

  pr_agent_job:
    permissions:
      contents: read
      pull-requests: write
    runs-on: ubuntu-latest
    steps:
    - name: PR Agent action step
      uses: xieyuschen/pr-agent@main
      env:
        OPENAI_KEY: ${{ secrets.OPENAI__KEY }}
        OPENAI.API_BASE: "https://api.poe.com/v1"
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        config.model: "gemini-2.0-flash"
        pr_reviewer.extra_instructions: |
          Check whether there are typos or wrong words that not suitable in the Contexts. 
          Reply Chinese for Chinese Contexts, reply English for English Contexts.