8000 GitHub - dwmkerr/terminal-ai-action: GitHub action to run AI commands as part of pipelines.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

dwmkerr/terminal-ai-action

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

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terminal-ai-action

GitHub action to run AI commands as part of pipelines. Review code, comment on pull requests, open pull requests to add tests and more.

Caution: be mindful of costs given how many calls to APIs automated reviews can make, as well as how many tokens may be needed.

Quickstart

To use the terminal-ai-action:

  • Create a workflow, e.g. .github/workflows/review.yaml
  • Set an openAiApiKey, which will let you call the ai CLI
  • Pass your prompts to ai, use optional Helper Functions like ai_pr_diff to easily get diffs / logs / etc
  • Put results into comments, open pull requests and so on
name: Review PR
on:
  pull_request:

jobs:
  review:
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0 # get the full history.
    
      # Review the code. Examples in this repo show how to comment etc.
      - uses: dwmkerr/terminal-ai-action@latest
        with:
          openAiApiKey: ${{ secrets.OPENAI_API_KEY }}
          command: ai "review this PR" < ai_pr_diff

Examples

Review the changes in a pull request, suggest improvements, suggest a title and description

Screenshot of the PR summary example

Configuration

The following configuration is supported:

Configuration Description
openAiApiKey Required. OpenAI API Key.
command Required. The command to run. See Examples

Setting the API Key

Terminal AI requires that an OpenAI API Key is set. You can create a key by following the guide at OpenAI Platform - API Keys. Once you have a key it is recommended to store it in an Action Secret:

Screenshot of Actions Secret

Once you have created the secret you can pass it to the terminal-ai-action like so:

jobs:
  review:
    steps:
      - name: Review with Terminal AI
        uses: dwmkerr/terminal-ai-action@latest
        with:
          openAiApiKey: ${{ secrets.OPENAI_API_KEY }}
          command: ai "review this PR"

Helper Functions

Some scripts are available to run as part of the command to conveniently work with the code. They are linked into the bin folder so can be called directly, e.g:

# Get the diff of the PR to its base:
ai-pr-diff > ai "summarise this PR"

Available helpers:

Script Description
ai-pr-diff The result of git diff from a pull request to its target branch.

TODO

Quick and dirty task list:

About

GitHub action to run AI commands as part of pipelines.

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0