From 2239b4baebc453b4fe075490b26c1ec014827594 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Tue, 12 Sep 2023 16:23:15 +0200 Subject: [PATCH 01/34] feat: first attempt at custom github action plus test workflow --- .github/workflows/test.yml | 18 ++++++++++++++++++ action.yml | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/test.yml create mode 100644 action.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..f8961a6a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,18 @@ +name: Test My Custom Action + +on: + push: + branches: + - feat/github-marketplace-action + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Use My Custom Action + uses: ./action.yml # Reference your custom action directory + with: + MODEL: 'gpt-3.5-turbo' diff --git a/action.yml b/action.yml new file mode 100644 index 00000000..9817a050 --- /dev/null +++ b/action.yml @@ -0,0 +1,34 @@ +name: 'Code Review GPT' +description: 'A description of what your action does.' +author: 'Orion Tools' +inputs: + MODEL: + description: 'The GPT model to use' + required: true + default: 'gpt-3.5-turbo' + # OPENAI_API_KEY: + # description: 'OpenAI API Key' + # required: true +runs: + using: 'composite' + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Install dependencies + shell: bash + run: npm ci + + # - name: Export OpenAI Api Key + # shell: bash + # run: export OPENAI_API_KEY=${{ inputs.OPENAI_API_KEY }} + + - name: Run Code Review GPT + shell: bash + run: | + cd code-review-gpt + npm run start -- --ci=github --model=${{ inputs.MODEL }} + From dcf05d864ab5bea989fd6760136b5d42d30b2e59 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Tue, 12 Sep 2023 16:24:42 +0200 Subject: [PATCH 02/34] chore: correcting action file path in test workflow --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f8961a6a..20571be8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,6 +13,6 @@ jobs: uses: actions/checkout@v2 - name: Use My Custom Action - uses: ./action.yml # Reference your custom action directory + uses: ../action.yml # Reference your custom action directory with: MODEL: 'gpt-3.5-turbo' From e6c6213f938caf047d2b9617755be4b514e5e722 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Tue, 12 Sep 2023 16:28:13 +0200 Subject: [PATCH 03/34] chore: add input variable to test.yml --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 20571be8..6927a481 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,4 +15,5 @@ jobs: - name: Use My Custom Action uses: ../action.yml # Reference your custom action directory with: + OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} MODEL: 'gpt-3.5-turbo' From 7bdcc950dc2d278def2ba339feb485be08c3e262 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Tue, 12 Sep 2023 16:35:48 +0200 Subject: [PATCH 04/34] chore: move -uses attribute --- .github/workflows/test.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6927a481..1e6ce08e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,13 +4,12 @@ on: push: branches: - feat/github-marketplace-action - + jobs: test: runs-on: ubuntu-latest steps: - - name: Checkout code - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Use My Custom Action uses: ../action.yml # Reference your custom action directory From a3a711bad952bce3475bfef009972e37afb4f9e8 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Tue, 12 Sep 2023 16:40:59 +0200 Subject: [PATCH 05/34] feat: edit action file path --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1e6ce08e..8bbf4074 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,7 +4,7 @@ on: push: branches: - feat/github-marketplace-action - + jobs: test: runs-on: ubuntu-latest @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v4 - name: Use My Custom Action - uses: ../action.yml # Reference your custom action directory + uses: ../ # Reference your custom action directory with: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} MODEL: 'gpt-3.5-turbo' From d6817fcb2f0650695928b752a6344a8e3f81663d Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Tue, 12 Sep 2023 16:43:44 +0200 Subject: [PATCH 06/34] chore: action path change in test.yml --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8bbf4074..a1be98ea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v4 - name: Use My Custom Action - uses: ../ # Reference your custom action directory + uses: ./ # Reference your custom action directory with: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} MODEL: 'gpt-3.5-turbo' From abb2f2d7c5b1b33556e1226e8e1722100e3e7c9f Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Tue, 12 Sep 2023 16:45:00 +0200 Subject: [PATCH 07/34] chore: uncommenting needed code --- action.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/action.yml b/action.yml index 9817a050..d413bb97 100644 --- a/action.yml +++ b/action.yml @@ -6,9 +6,9 @@ inputs: description: 'The GPT model to use' required: true default: 'gpt-3.5-turbo' - # OPENAI_API_KEY: - # description: 'OpenAI API Key' - # required: true + OPENAI_API_KEY: + description: 'OpenAI API Key' + required: true runs: using: 'composite' steps: @@ -22,9 +22,9 @@ runs: shell: bash run: npm ci - # - name: Export OpenAI Api Key - # shell: bash - # run: export OPENAI_API_KEY=${{ inputs.OPENAI_API_KEY }} + - name: Export OpenAI Api Key + shell: bash + run: export OPENAI_API_KEY=${{ inputs.OPENAI_API_KEY }} - name: Run Code Review GPT shell: bash From 3907d95ca7da94b28ac42eaf399d51636f36ad7c Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Tue, 12 Sep 2023 17:02:02 +0200 Subject: [PATCH 08/34] feat: install code-review-gpt package --- action.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index d413bb97..b19ef9f9 100644 --- a/action.yml +++ b/action.yml @@ -18,10 +18,12 @@ runs: with: node-version: 18 - - name: Install dependencies + - name: Install code-review-gpt shell: bash - run: npm ci - + run: | + npm code-review-gpt + npx code-review-gpt configure --setupTarget=github + - name: Export OpenAI Api Key shell: bash run: export OPENAI_API_KEY=${{ inputs.OPENAI_API_KEY }} From 021dfb17f838496c5f7000e697d099be5d07a629 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Tue, 12 Sep 2023 17:07:45 +0200 Subject: [PATCH 09/34] chore: add missing npm param --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index b19ef9f9..4ed82756 100644 --- a/action.yml +++ b/action.yml @@ -21,7 +21,7 @@ runs: - name: Install code-review-gpt shell: bash run: | - npm code-review-gpt + npm install code-review-gpt npx code-review-gpt configure --setupTarget=github - name: Export OpenAI Api Key From 2c6ecb4dbdd22b62850052885c9e78aec164aebf Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Tue, 12 Sep 2023 17:10:09 +0200 Subject: [PATCH 10/34] chore: remove npx command --- action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/action.yml b/action.yml index 4ed82756..4ad232ec 100644 --- a/action.yml +++ b/action.yml @@ -22,7 +22,6 @@ runs: shell: bash run: | npm install code-review-gpt - npx code-review-gpt configure --setupTarget=github - name: Export OpenAI Api Key shell: bash From e4355795394bb8270dfb6ec895069788ce56c50f Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Tue, 12 Sep 2023 17:16:46 +0200 Subject: [PATCH 11/34] feat: adding npx and ts-node to trigger review --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 4ad232ec..d29bf9dc 100644 --- a/action.yml +++ b/action.yml @@ -31,5 +31,5 @@ runs: shell: bash run: | cd code-review-gpt - npm run start -- --ci=github --model=${{ inputs.MODEL }} + npx ts-node ./src/index.ts -- --ci=github --model=${{ inputs.MODEL }} From b47bcbdfe0c1f97127b511d2725e06f010957f1a Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 09:01:47 +0200 Subject: [PATCH 12/34] feat: add clean install to run command --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index d29bf9dc..641565da 100644 --- a/action.yml +++ b/action.yml @@ -31,5 +31,6 @@ runs: shell: bash run: | cd code-review-gpt + npm ci npx ts-node ./src/index.ts -- --ci=github --model=${{ inputs.MODEL }} From 7d28638afbc066d04cf29fcd36611092b67c8001 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 09:09:04 +0200 Subject: [PATCH 13/34] feat: moving inputs to env variables --- action.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 641565da..355da9ba 100644 --- a/action.yml +++ b/action.yml @@ -25,12 +25,16 @@ runs: - name: Export OpenAI Api Key shell: bash - run: export OPENAI_API_KEY=${{ inputs.OPENAI_API_KEY }} + run: export OPENAI_API_KEY=$OPENAI_API_KEY - name: Run Code Review GPT shell: bash run: | cd code-review-gpt npm ci - npx ts-node ./src/index.ts -- --ci=github --model=${{ inputs.MODEL }} + npx ts-node ./src/index.ts -- --ci=github --model=$MODEL + + env: + MODEL: ${{ inputs.MODEL }} + OPENAI_API_KEY: ${{ inputs.OPENAI_API_KEY }} From a793bef11eececb3818f7f69fb0efd1477b41fe2 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 09:14:55 +0200 Subject: [PATCH 14/34] chore: separate run jobs for debugging --- action.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 355da9ba..b028241d 100644 --- a/action.yml +++ b/action.yml @@ -27,14 +27,18 @@ runs: shell: bash run: export OPENAI_API_KEY=$OPENAI_API_KEY + - name: Change directory + shell: bash + run: cd code-review-gpt + + - name: Npm clean install + shell: bash + run: npm ci + - name: Run Code Review GPT shell: bash - run: | - cd code-review-gpt - npm ci - npx ts-node ./src/index.ts -- --ci=github --model=$MODEL + run: npx ts-node ./src/index.ts -- --ci=github --model=$MODEL env: MODEL: ${{ inputs.MODEL }} OPENAI_API_KEY: ${{ inputs.OPENAI_API_KEY }} - From c0bdf91736d28140eabb9af3dce66ca3f87801f1 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 09:21:20 +0200 Subject: [PATCH 15/34] chore: move cd into run command --- action.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/action.yml b/action.yml index b028241d..be9e5bba 100644 --- a/action.yml +++ b/action.yml @@ -26,18 +26,12 @@ runs: - name: Export OpenAI Api Key shell: bash run: export OPENAI_API_KEY=$OPENAI_API_KEY - - - name: Change directory - shell: bash - run: cd code-review-gpt - - - name: Npm clean install - shell: bash - run: npm ci - name: Run Code Review GPT shell: bash - run: npx ts-node ./src/index.ts -- --ci=github --model=$MODEL + run: | + cd code-review-gpt + npx ts-node ./src/index.ts -- --ci=github --model=$MODEL env: MODEL: ${{ inputs.MODEL }} From 4d61d103f8b0b816e7e604eca6ef2ae7c7b847dc Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 09:43:45 +0200 Subject: [PATCH 16/34] chore: move install into run command --- action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index be9e5bba..0016b0d2 100644 --- a/action.yml +++ b/action.yml @@ -18,10 +18,9 @@ runs: with: node-version: 18 - - name: Install code-review-gpt - shell: bash - run: | - npm install code-review-gpt + # - name: Install code-review-gpt + # shell: bash + # run: npm install code-review-gpt - name: Export OpenAI Api Key shell: bash @@ -30,6 +29,7 @@ runs: - name: Run Code Review GPT shell: bash run: | + npm install code-review-gpt cd code-review-gpt npx ts-node ./src/index.ts -- --ci=github --model=$MODEL From 0b370767ddce7e3bb8dabdc6debde3f4bf7574f0 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 09:44:33 +0200 Subject: [PATCH 17/34] chore: revert changes --- action.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/action.yml b/action.yml index 0016b0d2..57289b2e 100644 --- a/action.yml +++ b/action.yml @@ -18,9 +18,9 @@ runs: with: node-version: 18 - # - name: Install code-review-gpt - # shell: bash - # run: npm install code-review-gpt + - name: Install code-review-gpt + shell: bash + run: npm install code-review-gpt - name: Export OpenAI Api Key shell: bash @@ -29,7 +29,6 @@ runs: - name: Run Code Review GPT shell: bash run: | - npm install code-review-gpt cd code-review-gpt npx ts-node ./src/index.ts -- --ci=github --model=$MODEL From 03e18a03a7812cb64d841fd42a920de6df7b1150 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 10:56:57 +0200 Subject: [PATCH 18/34] feat: changing to npm ci --- action.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 57289b2e..8b7ea6ee 100644 --- a/action.yml +++ b/action.yml @@ -18,9 +18,9 @@ runs: with: node-version: 18 - - name: Install code-review-gpt + - name: Install code-review-gpt dependencies shell: bash - run: npm install code-review-gpt + run: cd code-review-gpt && npm ci - name: Export OpenAI Api Key shell: bash @@ -28,9 +28,7 @@ runs: - name: Run Code Review GPT shell: bash - run: | - cd code-review-gpt - npx ts-node ./src/index.ts -- --ci=github --model=$MODEL + run: npx ts-node ./src/index.ts -- --ci=github --model=$MODEL env: MODEL: ${{ inputs.MODEL }} From e395b3a0fe284df4ec461fdcc2c9aec9467567a6 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 11:09:21 +0200 Subject: [PATCH 19/34] feat: trying different commands --- action.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 8b7ea6ee..e3a4fcec 100644 --- a/action.yml +++ b/action.yml @@ -18,17 +18,21 @@ runs: with: node-version: 18 - - name: Install code-review-gpt dependencies - shell: bash - run: cd code-review-gpt && npm ci + # - name: Install code-review-gpt dependencies + # shell: bash + # run: cd code-review-gpt && npm ci - name: Export OpenAI Api Key shell: bash run: export OPENAI_API_KEY=$OPENAI_API_KEY - - name: Run Code Review GPT + # - name: Run Code Review GPT + # shell: bash + # run: npx ts-node ./src/index.ts -- --ci=github --model=$MODEL + + - name: Install & add code-review-gpt to CI shell: bash - run: npx ts-node ./src/index.ts -- --ci=github --model=$MODEL + run: npm install code-review-gpt && npx code-review-gpt configure --setupTarget=github env: MODEL: ${{ inputs.MODEL }} From 832bdd8d136161c000933b7ad924b5ae7dd9b05d Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 11:13:46 +0200 Subject: [PATCH 20/34] feat: moving aip key export after installation --- action.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index e3a4fcec..0f49f200 100644 --- a/action.yml +++ b/action.yml @@ -21,10 +21,6 @@ runs: # - name: Install code-review-gpt dependencies # shell: bash # run: cd code-review-gpt && npm ci - - - name: Export OpenAI Api Key - shell: bash - run: export OPENAI_API_KEY=$OPENAI_API_KEY # - name: Run Code Review GPT # shell: bash @@ -32,7 +28,13 @@ runs: - name: Install & add code-review-gpt to CI shell: bash - run: npm install code-review-gpt && npx code-review-gpt configure --setupTarget=github + run: | + npm install code-review-gpt + npx code-review-gpt configure --setupTarget=github + + - name: Export OpenAI Api Key + shell: bash + run: export OPENAI_API_KEY=$OPENAI_API_KEY env: MODEL: ${{ inputs.MODEL }} From 35e34d195bc17e5b77742892c06b37a0e691c1e2 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 11:15:41 +0200 Subject: [PATCH 21/34] chore: removing api key export --- action.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/action.yml b/action.yml index 0f49f200..c318e3c1 100644 --- a/action.yml +++ b/action.yml @@ -32,10 +32,6 @@ runs: npm install code-review-gpt npx code-review-gpt configure --setupTarget=github - - name: Export OpenAI Api Key - shell: bash - run: export OPENAI_API_KEY=$OPENAI_API_KEY - env: MODEL: ${{ inputs.MODEL }} OPENAI_API_KEY: ${{ inputs.OPENAI_API_KEY }} From fe5c7d21de2b8d6a9e6cccb8f68da7e3553689bb Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 11:39:26 +0200 Subject: [PATCH 22/34] chore: remove setup target arg --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index c318e3c1..d4ddbb82 100644 --- a/action.yml +++ b/action.yml @@ -30,7 +30,7 @@ runs: shell: bash run: | npm install code-review-gpt - npx code-review-gpt configure --setupTarget=github + npx code-review-gpt configure env: MODEL: ${{ inputs.MODEL }} From 5e32625aeffe09227d2410f1dbc7df75d90f1090 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 11:40:39 +0200 Subject: [PATCH 23/34] chore: revert changes --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index d4ddbb82..c318e3c1 100644 --- a/action.yml +++ b/action.yml @@ -30,7 +30,7 @@ runs: shell: bash run: | npm install code-review-gpt - npx code-review-gpt configure + npx code-review-gpt configure --setupTarget=github env: MODEL: ${{ inputs.MODEL }} From ae7e6059f6526872941d000f7adea5bd95ac903b Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 11:51:01 +0200 Subject: [PATCH 24/34] feat: changing to npm run start --- action.yml | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/action.yml b/action.yml index c318e3c1..6055304f 100644 --- a/action.yml +++ b/action.yml @@ -18,19 +18,20 @@ runs: with: node-version: 18 - # - name: Install code-review-gpt dependencies - # shell: bash - # run: cd code-review-gpt && npm ci + - name: Install code-review-gpt dependencies + shell: bash + run: cd code-review-gpt && npm ci - # - name: Run Code Review GPT - # shell: bash - # run: npx ts-node ./src/index.ts -- --ci=github --model=$MODEL - - - name: Install & add code-review-gpt to CI + - name: Run Code Review GPT shell: bash - run: | - npm install code-review-gpt - npx code-review-gpt configure --setupTarget=github + run: npm run start -- --ci=github --model=gpt-3.5-turbo + # run: npx ts-node ./src/index.ts -- --ci=github --model=$MODEL + + # - name: Install & add code-review-gpt to CI + # shell: bash + # run: | + # npm install code-review-gpt + # npx code-review-gpt configure --setupTarget=github env: MODEL: ${{ inputs.MODEL }} From 647496f8784fafc810102c6405d6dfbc0f3054ab Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 11:53:05 +0200 Subject: [PATCH 25/34] feat: remove checkout action --- action.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/action.yml b/action.yml index 6055304f..c1fd0828 100644 --- a/action.yml +++ b/action.yml @@ -12,8 +12,6 @@ inputs: runs: using: 'composite' steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 with: node-version: 18 From 029aaee0747f7bf28a71cc5548c828c60a032151 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 11:56:22 +0200 Subject: [PATCH 26/34] feat: using npx to run code-review-gpt --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index c1fd0828..469a8f9e 100644 --- a/action.yml +++ b/action.yml @@ -16,13 +16,13 @@ runs: with: node-version: 18 - - name: Install code-review-gpt dependencies + - name: Install code-review-gpt shell: bash - run: cd code-review-gpt && npm ci + run: npm install code-review-gpt - name: Run Code Review GPT shell: bash - run: npm run start -- --ci=github --model=gpt-3.5-turbo + run: npx code-review-gpt review # run: npx ts-node ./src/index.ts -- --ci=github --model=$MODEL # - name: Install & add code-review-gpt to CI From 07f151b3f22668a0b2a9e6755c2cc12fc07515bc Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 11:59:41 +0200 Subject: [PATCH 27/34] feat: adding ci and model flags --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 469a8f9e..5d906ac9 100644 --- a/action.yml +++ b/action.yml @@ -22,7 +22,7 @@ runs: - name: Run Code Review GPT shell: bash - run: npx code-review-gpt review + run: npx code-review-gpt review --ci=github --model=$MODEL # run: npx ts-node ./src/index.ts -- --ci=github --model=$MODEL # - name: Install & add code-review-gpt to CI From 63d4dd1c79eff725bada4b3ba04bbb86c249c6c7 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 12:04:55 +0200 Subject: [PATCH 28/34] feat: passing base_sha and github_token manually --- .github/workflows/test.yml | 2 ++ action.yml | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a1be98ea..242c5e38 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,3 +16,5 @@ jobs: with: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} MODEL: 'gpt-3.5-turbo' + BASE_SHA: ${{ secrets.BASE_SHA }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/action.yml b/action.yml index 5d906ac9..a33acd1b 100644 --- a/action.yml +++ b/action.yml @@ -9,6 +9,12 @@ inputs: OPENAI_API_KEY: description: 'OpenAI API Key' required: true + BASE_SHA: + description: 'Base SHA' + required: true + GITHUB_TOKEN: + description: 'Github token' + required: true runs: using: 'composite' steps: @@ -34,3 +40,5 @@ runs: env: MODEL: ${{ inputs.MODEL }} OPENAI_API_KEY: ${{ inputs.OPENAI_API_KEY }} + BASE_SHA: ${{ inputs.BASE_SHA }} + GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}s From 1e6e605fb544f388196a4c47d6199187b9862036 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 12:20:47 +0200 Subject: [PATCH 29/34] feat: getting base_sha from github context and moving code checkout into custom action --- .github/workflows/test.yml | 3 --- action.yml | 14 +++----------- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 242c5e38..fbc9b9f0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,12 +9,9 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: Use My Custom Action uses: ./ # Reference your custom action directory with: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} MODEL: 'gpt-3.5-turbo' - BASE_SHA: ${{ secrets.BASE_SHA }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/action.yml b/action.yml index a33acd1b..5275558a 100644 --- a/action.yml +++ b/action.yml @@ -9,15 +9,14 @@ inputs: OPENAI_API_KEY: description: 'OpenAI API Key' required: true - BASE_SHA: - description: 'Base SHA' - required: true GITHUB_TOKEN: description: 'Github token' required: true runs: using: 'composite' steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 with: node-version: 18 @@ -29,16 +28,9 @@ runs: - name: Run Code Review GPT shell: bash run: npx code-review-gpt review --ci=github --model=$MODEL - # run: npx ts-node ./src/index.ts -- --ci=github --model=$MODEL - - # - name: Install & add code-review-gpt to CI - # shell: bash - # run: | - # npm install code-review-gpt - # npx code-review-gpt configure --setupTarget=github env: MODEL: ${{ inputs.MODEL }} OPENAI_API_KEY: ${{ inputs.OPENAI_API_KEY }} - BASE_SHA: ${{ inputs.BASE_SHA }} + BASE_SHA: ${{ github.event.pull_request.base.sha }} GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}s From 620e37bca7e12ffe526443623182259a30a6c157 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 12:23:58 +0200 Subject: [PATCH 30/34] feat: changing checkout action version --- action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/action.yml b/action.yml index 5275558a..940d7bec 100644 --- a/action.yml +++ b/action.yml @@ -15,13 +15,13 @@ inputs: runs: using: 'composite' steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 - uses: actions/setup-node@v3 with: node-version: 18 - - name: Install code-review-gpt + - name: Install Code Review GPT shell: bash run: npm install code-review-gpt From 51bcb5172e2a13c43ca754a90b9336950b16f7fa Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 12:26:55 +0200 Subject: [PATCH 31/34] chore: adding checkout back to test.yml file --- .github/workflows/test.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fbc9b9f0..f9aedfef 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,6 +9,8 @@ jobs: test: runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 + - name: Use My Custom Action uses: ./ # Reference your custom action directory with: From f55411228b8a1c421f16a43d043bdf3c74816068 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 12:29:35 +0200 Subject: [PATCH 32/34] feat: changed description --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 940d7bec..407568ed 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ name: 'Code Review GPT' -description: 'A description of what your action does.' +description: 'Reviews the staged files with a GPT model from OpenAI' author: 'Orion Tools' inputs: MODEL: @@ -15,7 +15,7 @@ inputs: runs: using: 'composite' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: actions/setup-node@v3 with: @@ -33,4 +33,4 @@ runs: MODEL: ${{ inputs.MODEL }} OPENAI_API_KEY: ${{ inputs.OPENAI_API_KEY }} BASE_SHA: ${{ github.event.pull_request.base.sha }} - GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}s + GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }} From 557cbbfcff5f59cbfc11abae4dc37fdb7e8f1942 Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 12:51:08 +0200 Subject: [PATCH 33/34] feat: renaming inside test.yml --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f9aedfef..513c5d34 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Test My Custom Action +name: Test for this repo's custom action.yml file on: push: @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v4 - name: Use My Custom Action - uses: ./ # Reference your custom action directory + uses: ./ with: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} MODEL: 'gpt-3.5-turbo' From d5773055dfc5a79bacc22e72c67916ebc215b5fb Mon Sep 17 00:00:00 2001 From: Sebastian Oliver Date: Wed, 13 Sep 2023 13:00:01 +0200 Subject: [PATCH 34/34] chore: remove testing file --- .github/workflows/test.yml | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 513c5d34..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Test for this repo's custom action.yml file - -on: - push: - branches: - - feat/github-marketplace-action - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Use My Custom Action - uses: ./ - with: - OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - MODEL: 'gpt-3.5-turbo' - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}