https://github.com/fitomad/github-chatgpt-integration
How to integrate ChatGPT with a GitHub repository using GitHub Actions in order to perform automated code reviews for every pull request
https://github.com/fitomad/github-chatgpt-integration
chatgpt chatgpt-api github github-actions openai python
Last synced: 6 months ago
JSON representation
How to integrate ChatGPT with a GitHub repository using GitHub Actions in order to perform automated code reviews for every pull request
- Host: GitHub
- URL: https://github.com/fitomad/github-chatgpt-integration
- Owner: fitomad
- Created: 2023-03-18T10:57:05.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-03-25T19:20:45.000Z (almost 3 years ago)
- Last Synced: 2025-07-22T23:58:55.811Z (6 months ago)
- Topics: chatgpt, chatgpt-api, github, github-actions, openai, python
- Language: Python
- Homepage:
- Size: 66.4 KB
- Stars: 11
- Watchers: 1
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# GitHub & ChatGPT integration
 
This PoC is related to the integration of ChatGPT into a GitHub repository through [GitHub Actions](https://github.com/features/actions).
Actually there's no way to allow ChatGPT access a GitHub repository, inclusing the Pull Request permormed in any repository branch.
## Design
We will obtain this integration thanks to GitHub actions. This repository contains an Action that performs the following tasks.
* Pull Request checking and analizing, providing comments abou the repo.
## Use this action in your CI/CD
You need to create two secrets in order to run this action
* `OPENAI_API_KEY` Create an OpenAI developer account and obtain an API acces key
* `GH_TOKEN` Create a GitHub developer access token
Other fields that you can customize are
* `dev-lang` Define the programming language using in your repository
```yaml
name: App Code Review
permissions:
contents: read
pull-requests: write
on:
pull_request:
types: [opened, reopened]
jobs:
code-review:
runs-on: ubuntu-latest
steps:
- uses: fitomad/github-chatgpt-integration@main
with:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
github-token: ${{ secrets.GH_TOKEN }}
github-pr-id: ${{ github.event.number }}
dev-lang: Swift
openai-max-tokens: 4096
```
## GitHub Action
Our shell script must be executable. Make sure the `main.sh` file has execute permissions before using it in a workflow. You can modify the permission from your terminal using these commands.
Using the `update-index` parameter we will be sure that the execution flag will not be reseted every time we fork or create a new branch.
```zsh
$ git add entrypoint.sh
$ git update-index --chmod=+x entrypoint.sh
```
## Contact
* **Email** [adolfo.vera@globant.com](mailto:adolfo.vera@globant.com)
* **LinkedIn** [https://www.linkedin.com/in/adolfo-vera](https://www.linkedin.com/in/adolfo-vera)