From 133a516db30aed15d7fd8887cb5e4cd318e20a40 Mon Sep 17 00:00:00 2001 From: Daniel Wang Date: Sat, 20 May 2023 14:41:02 +0800 Subject: [PATCH 1/2] enable openAI-based review --- .github/workflows/openai-review.yml | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/openai-review.yml diff --git a/.github/workflows/openai-review.yml b/.github/workflows/openai-review.yml new file mode 100644 index 00000000000..af4f9297ead --- /dev/null +++ b/.github/workflows/openai-review.yml @@ -0,0 +1,35 @@ +on: [pull_request] + +jobs: + add_pr_comment: + permissions: write-all + runs-on: ubuntu-latest + name: OpenAI PR Comment + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 2 + - id: patch + run: | + patch_output=$(curl --silent --request GET \ + --url https://api.github.com/repos/$PATCH_REPO/pulls/$PATCH_PR \ + --header "Accept: application/vnd.github.v3.patch" \ + --header "Authorization: Bearer $PATCH_GITHUB_TOKEN") + echo $patch_output + echo "GIT_PATCH_OUTPUT=$(echo $patch_output)" >> $GITHUB_ENV + env: + PATCH_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PATCH_PR: ${{ github.event.pull_request.number }} + PATCH_REPO: ${{ github.repository }} + - id: review + uses: MXCzkEVM/GPTReviewWorkflow@main + with: + GIT_COMMIT_HASH: ${{ github.event.pull_request.head.sha }} + GIT_PATCH_OUTPUT: ${{ env.GIT_PATCH_OUTPUT }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + OPENAI_ORG_KEY: ${{ secrets.OPENAI_ORG_KEY }} + PR_NUMBER: ${{ github.event.pull_request.number }} + PR_TITLE: ${{ github.event.pull_request.title }} + REPOSITORY_NAME: ${{ github.repository }} From 302e37acb894cebc4a30621008cbd0c755bf6494 Mon Sep 17 00:00:00 2001 From: Daniel Wang <99078276+dantaik@users.noreply.github.com> Date: Sat, 20 May 2023 15:01:49 +0800 Subject: [PATCH 2/2] Update openai-review.yml --- .github/workflows/openai-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/openai-review.yml b/.github/workflows/openai-review.yml index af4f9297ead..4ec1361f04d 100644 --- a/.github/workflows/openai-review.yml +++ b/.github/workflows/openai-review.yml @@ -23,7 +23,7 @@ jobs: PATCH_PR: ${{ github.event.pull_request.number }} PATCH_REPO: ${{ github.repository }} - id: review - uses: MXCzkEVM/GPTReviewWorkflow@main + uses: taikoxyz/openai-review-action@main with: GIT_COMMIT_HASH: ${{ github.event.pull_request.head.sha }} GIT_PATCH_OUTPUT: ${{ env.GIT_PATCH_OUTPUT }}