Skip to content
/ AdaGPT Public

@AdaGPT: AI support for Issues and Pull Requests right at your fingertips!

License

Notifications You must be signed in to change notification settings

zirkelc/AdaGPT

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

AdaGPT GitHub Action

AdaGPT is an AI-powered GitHub Action that generates helpful responses to comments on issues and pull requests. It's like having a conversation with ChatGPT, but without actually leaving GitHub and available to everyone.

Simply mention @AdaGPT in your comments on issues and pull requests. AdaGPT will be activated and respond to your comment with a helpful response.

Who's Ada?

Ada is named after Ada Lovelace, a pioneer of computer programming and the first person to write an algorithm intended to be processed by a machine. Ada is considered the first computer programmer and a symbol of women's contributions to science and technology.

Getting Started

To use AdaGPT, you'll need to create an OpenAI API key and add AdaGPT to your workflow. Here are the steps to get started:

  1. Create an OpenAI API key if you don't already have one. Keep in mind that you'll occur charges for using the API.
  2. Save your OpenAI API key as a Secret in your repository.
  3. Create a new workflow in folder .github/workflows that will be triggered on issues, pull requests and comments.

Workflow

# File: .github/workflows/adagpt.yml
name: 'AdaGPT'

# Run the workflow on new issues, pull requests and comments
on:
  issues:
    types: [opened]
  pull_request:
    types: [opened]
  issue_comment:
    types: [created]

# Allows the workflow to create comments on issues and pull requests
permissions:
  issues: write
  pull-requests: write

jobs:
  # Runs for issues, pull requests and comments
  adagpt:
    name: AdaGPT comment
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3  
      # The action will only run if the description or comments mentions @AdaGPT
      - uses: zirkelc/adagpt@v1
        name: AdaGPT
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          openai_key: ${{ secrets.OPENAI_KEY }}

The action will only run if the issue, pull requests or comments mentions @AdaGPT. Otherwise, the action will return immediately without doing anything. If you want to skip the whole workflow run, you can use the if conditional to check if the issue, pull request or comment mentions @AdaGPT.

jobs:
  # Runs only for issues
  issue:
    name: Issue opened
    # Check if the issue contains @AdaGPT, otherwise skip the workflow run
    if: ${{ github.event_name == 'issues' && contains(github.event.issue.body, '@AdaGPT') }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3  
      - uses: zirkelc/adagpt@v1
        name: AdaGPT
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          openai_key: ${{ secrets.OPENAI_KEY }}     

Check out main.yml for more examples.

Permissions

The GITHUB_TOKEN requires the following permissions to create comments on issues and pull requests:

  • issues: write
  • pull-requests: write

Add these permissions to your workflow or individual jobs using the permissions keyword.

Secrets

Sensitive information, such as the OpenAI API key, should be stored as encrypted secrets in the repository.

Add your OpenAI API key as a secret to your repository and reference it using the ${{ secrets.OPENAI_KEY }} syntax.

Action Inputs

Name Required Default Description
github_token Yes The access token used to retrieve and create comments on the issues and pull requests. This will typically be your GitHub token. If so, use ${{ secrets.GITHUB_TOKEN }}
openai_key Yes The API key used for OpenAI chat completion request. Go to OpenAI to create a new API key
openai_temperature No 0.8 What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. See API reference for more information.
openai_top_p No 0 An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. See API reference for more information.
openai_max_tokens No 4096 The maximum number of tokens to generate in the completion. See API reference for more information.

Examples

2023-05-02_18-24-08


image

Contributing

We welcome bug reports, feature requests, and contributions to AdaGPT! If you'd like to contribute, please open an issue or pull request on this repository.

License

AdaGPT is licensed under the MIT License. See the LICENSE file for more information.