From f9ba72203d7bd01ff0e0a6dbd4b7f46baba21b26 Mon Sep 17 00:00:00 2001
From: mschwoerer <82171591+mschwoer@users.noreply.github.com>
Date: Mon, 13 Jan 2025 12:06:15 +0100
Subject: [PATCH] add code review

---
 .github/workflows/code_review.yml | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 .github/workflows/code_review.yml

diff --git a/.github/workflows/code_review.yml b/.github/workflows/code_review.yml
new file mode 100644
index 00000000..a61555a5
--- /dev/null
+++ b/.github/workflows/code_review.yml
@@ -0,0 +1,24 @@
+# Create an automated AI code review that runs when a PR is labeled with 'code-review'
+name: code-review
+
+on:
+  pull_request:
+    types: [ labeled ]
+
+jobs:
+  get-code-review:
+    runs-on: ubuntu-latest
+    if: contains(github.event.pull_request.labels.*.name, 'code-review') # || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
+    permissions:
+      contents: read
+      pull-requests: write
+    steps:
+      - uses: MannLabs/alphashared/actions/code-review@v1
+        continue-on-error: true
+        with:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
+          CODE_REVIEW_PROMPT: ${{ secrets.CODE_REVIEW_PROMPT }}
+          CODE_REVIEW_SYSTEM_MESSAGE: ${{ secrets.CODE_REVIEW_SYSTEM_MESSAGE }}
+          GITHUB_EVENT_NUMBER: ${{ github.event.number }}
+          EXCLUDED_EXTENSIONS: "ipynb;js"