This PoC is related to the integration of ChatGPT into a GitHub repository through GitHub Actions.
Actually there's no way to allow ChatGPT access a GitHub repository, inclusing the Pull Request permormed in any repository branch.
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.
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 keyGH_TOKEN
Create a GitHub developer access token
Other fields that you can customize are
dev-lang
Define the programming language using in your repository
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
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.
$ git add entrypoint.sh
$ git update-index --chmod=+x entrypoint.sh
- Email [email protected]
- LinkedIn https://www.linkedin.com/in/adolfo-vera