From 43238e3c19c6e129ce649dcf3892914c3f5fa9eb Mon Sep 17 00:00:00 2001 From: Patrick Bassner Date: Mon, 4 Dec 2023 18:43:55 +0100 Subject: [PATCH 1/3] add gpt code reviewer --- .github/workflows/crgpt.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/crgpt.yml diff --git a/.github/workflows/crgpt.yml b/.github/workflows/crgpt.yml new file mode 100644 index 000000000000..a08f2aedc941 --- /dev/null +++ b/.github/workflows/crgpt.yml @@ -0,0 +1,21 @@ +name: Code Review GPT + +on: + pull_request: + types: [labeled, synchronize] + +jobs: + run_code_review: + if: contains(github.event.pull_request.labels.*.name, 'ready for review') && !github.event.pull_request.draft + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Code Review GPT + uses: mattzcarey/code-review-gpt@v0.1.5 + with: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} + MODEL: 'gpt-3.5-turbo' + GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file From 3caa2a791dd9511ed3b8959b35ea7d20eed12a70 Mon Sep 17 00:00:00 2001 From: Patrick Bassner Date: Mon, 4 Dec 2023 18:55:28 +0100 Subject: [PATCH 2/3] fix? --- .github/workflows/crgpt.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/crgpt.yml b/.github/workflows/crgpt.yml index a08f2aedc941..af83d5b3d7c0 100644 --- a/.github/workflows/crgpt.yml +++ b/.github/workflows/crgpt.yml @@ -2,20 +2,25 @@ name: Code Review GPT on: pull_request: - types: [labeled, synchronize] + types: [opened, synchronize] + pull_request_target: + types: [ready_for_review] jobs: run_code_review: - if: contains(github.event.pull_request.labels.*.name, 'ready for review') && !github.event.pull_request.draft + if: > + (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ready for review') && !github.event.pull_request.draft) || + github.event_name == 'pull_request_target' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 with: fetch-depth: 0 + ref: ${{ github.head_ref || github.event.pull_request.head.ref }} - name: Code Review GPT uses: mattzcarey/code-review-gpt@v0.1.5 with: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} MODEL: 'gpt-3.5-turbo' - GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file + GITHUB_TOKEN: ${{ github.token }} From ed909601a020e4ac8273cdad84066cc8c8e30deb Mon Sep 17 00:00:00 2001 From: Patrick Bassner Date: Mon, 4 Dec 2023 20:14:24 +0100 Subject: [PATCH 3/3] hmm --- .github/workflows/crgpt.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/crgpt.yml b/.github/workflows/crgpt.yml index af83d5b3d7c0..c696189c6709 100644 --- a/.github/workflows/crgpt.yml +++ b/.github/workflows/crgpt.yml @@ -16,7 +16,6 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - ref: ${{ github.head_ref || github.event.pull_request.head.ref }} - name: Code Review GPT uses: mattzcarey/code-review-gpt@v0.1.5