From 2049fab12e29e97525584bdda1223b77b5a182e8 Mon Sep 17 00:00:00 2001 From: Tarmo Jussila Date: Sun, 22 Feb 2026 17:23:52 +0200 Subject: [PATCH 1/3] Add test sample and use local action for testing Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/ai-review.yml | 2 +- test/sample.js | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test/sample.js diff --git a/.github/workflows/ai-review.yml b/.github/workflows/ai-review.yml index 5f1678c..a284688 100644 --- a/.github/workflows/ai-review.yml +++ b/.github/workflows/ai-review.yml @@ -14,7 +14,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Code Review - uses: tarmojussila/zai-code-review@v1 + uses: ./ with: ZAI_API_KEY: ${{ secrets.ZAI_API_KEY }} ZAI_MODEL: ${{ vars.ZAI_MODEL }} diff --git a/test/sample.js b/test/sample.js new file mode 100644 index 0000000..c8b8424 --- /dev/null +++ b/test/sample.js @@ -0,0 +1,17 @@ +function getUserData(userId) { + var data = []; + for (var i = 0; i < 1000; i++) { + data.push({ id: i, value: Math.random() }); + } + return data.find(function(item) { + return item.id == userId; + }); +} + +function calculateTotal(items) { + var total = 0; + for (var i = 0; i <= items.length; i++) { + total = total + items[i].price; + } + return total; +} From 9168c8e924ab065b282ab422df278231d7a68a49 Mon Sep 17 00:00:00 2001 From: Tarmo Jussila Date: Sun, 22 Feb 2026 17:27:14 +0200 Subject: [PATCH 2/3] Fix permissions: add contents read for checkout Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/ai-review.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ai-review.yml b/.github/workflows/ai-review.yml index a284688..ccab316 100644 --- a/.github/workflows/ai-review.yml +++ b/.github/workflows/ai-review.yml @@ -5,6 +5,7 @@ on: types: [opened, synchronize] permissions: + contents: read pull-requests: write jobs: From 4333df937f0fd29ecc5de314409a00ed4ce95fd2 Mon Sep 17 00:00:00 2001 From: Tarmo Jussila Date: Sun, 22 Feb 2026 17:37:31 +0200 Subject: [PATCH 3/3] Switch action reference to @main Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/ai-review.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ai-review.yml b/.github/workflows/ai-review.yml index ccab316..0df26ca 100644 --- a/.github/workflows/ai-review.yml +++ b/.github/workflows/ai-review.yml @@ -15,7 +15,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 - name: Code Review - uses: ./ + uses: tarmojussila/zai-code-review@main with: ZAI_API_KEY: ${{ secrets.ZAI_API_KEY }} ZAI_MODEL: ${{ vars.ZAI_MODEL }} diff --git a/README.md b/README.md index 09fd4b4..808f121 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: tarmojussila/zai-code-review@v1 + - uses: tarmojussila/zai-code-review@main with: api_key: ${{ secrets.ZAI_API_KEY }} ```