Skip to content

Commit

Permalink
feat: how to setup the action in a repo plus how to publish a later v…
Browse files Browse the repository at this point in the history
…ersion of the action
  • Loading branch information
SEBRATHEZEBRA committed Sep 15, 2023
1 parent 4fec360 commit e0522c3
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions action.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Code Review GPT Action

## Setup

First thing you'd need to do is create an OpenAI Api Key secret in github, more info on how to set secrets for your github actions can be found [here](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions).

Once you've set your secret you can create a new file in your workflow called crgpt.yml, which should look like something seen below. An important attribute to include, is the fetch-depth of the checkout action below. Currently the action only works when it has access to the repo's entire commit history.

```shell
name: Code Review GPT

on:
pull_request:
branches: [main]

permissions:
id-token: write
pull-requests: write
contents: read
actions: read

jobs:
run_code_review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Code Review GPT
uses: mattzcarey/[email protected]
with:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
MODEL: 'gpt-3.5-turbo'
GITHUB_TOKEN: ${{ github.token }}
```

## Publishing a new version of the action

To publish a later version of the github action is simple. All you need to do is draft a new release for the repo and the current version of the action.yml on the main branch will be published to github marketplace.

0 comments on commit e0522c3

Please sign in to comment.