AdaGPT: AI support for Issues and Pull Requests right at your fingertips!
Tags: githubhack23, github, openai, opensource
Published: 2023-05-02 16:49:50

## What I built 
I have built AdaGPT, an AI-powered GitHub Action that generates helpful responses for Issues and Pull Requests. It's like having a conversation with ChatGPT, but without actually leaving GitHub and available to everyone.

All you have to do is mention [@AdaGPT] (https://github.com/AdaGPT) in your issue or comments and she will respond to you with a helpful and charming reply.

### Category Submission: 
Wacky Wildcards

### App Link: 
[Repository](https://github.com/zirkelc/AdaGPT)
[Marketplace](https://github.com/marketplace/actions/adagpt-in-action)

### Screenshots 
Here are some screenshots of Issues and Pull Requests

#### [Explain Pull Requests](https://github.com/zirkelc/AdaGPT/pull/2)
> AdaGPT can help you on Pull Requests.
![Explain Pull Requests](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/buey6o3kn3q8v0wo3uzi.jpg)

#### [Rock, Paper, Scissors!](https://github.com/zirkelc/AdaGPT/issues/8)
> With a little luck, you might convince AdaGPT to play a Rock, Paper, Scissors with you! 
![Rock, Paper, Scissors!](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6du5ff14197c1wlt3gxl.png)

#### [Tic, Tac, Toe](https://github.com/zirkelc/AdaGPT/issues/22)
> AdaGPT can help you to level up your Tic, Tac, Toe game.
![Tic, Tac, Toe](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/z3kjwv187n6exyvwqiwq.jpg)

### Description 
AdaGPT is a GitHub Action that responds to issues and pull requests if they mention `@AdaGPT`.  
AdaGPT takes into account the description of the issue as well as all existing comments. For pull requests, AdaGPT also has access to the Git diff the changes. 

### Link to Source Code 
[AdaGPT Repository](https://github.com/zirkelc/AdaGPT)

### Permissive License 
MIT

## Background (What made you decide to build this particular app? What inspired you?) 

Trying out AI has been on my list of side projects for a long time. This hackathon finally gave me the motivation to tackle it. The idea for this GitHub activity came to me while using ChatGPT. A conversation using ChatGPT is similar to a discussion in an issue or pull request. However, on GitHub, multiple people can participate in the discussion and the messages are visible to everyone. Therefore, it sounded like an exciting idea to simply include ChatGPT in conversations on GitHub and make it available to everyone. 

### How I built it (How did you utilize GitHub Actions or GitHub Codespaces? Did you learn something new along the way? Pick up a new skill?) 
The GitHub Action was implemented with TypeScript using the [GitHub Actions Toolkit](https://github.com/actions/toolkit) and the [OpenAI Node.js Library](https://github.com/openai/openai-node). 
The Action is activated on issues, pull requests, and comments, if the description or comment contains `@AdaGPT`. 
The relevant issue number is determined from the event payload and doesn't need to be passed separately. In case of a pull request, the git diff of all changes is retrieved from the GitHub API. Furthermore, if the Action was triggered by a comment, all existing previous comments are read from the API.

Finally, a corresponding prompt is generated from all information (issue, pull request diff, comments) and the request is sent to OpenAI. The response of the request is added as a new comment to the issue. 

### Additional Resources/Info