From 3599c6f92c2ee7ef5f228a5a76b57e77c138c5d6 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Mon, 24 Nov 2025 09:57:08 +1300 Subject: [PATCH 1/3] add ai review workflow --- .github/workflows/ai-review.yml | 42 +++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/ai-review.yml diff --git a/.github/workflows/ai-review.yml b/.github/workflows/ai-review.yml new file mode 100644 index 0000000000000..fc3547910b54d --- /dev/null +++ b/.github/workflows/ai-review.yml @@ -0,0 +1,42 @@ +name: AI PR Review + +on: + # pull_request: # enable this when we think this is ready + # types: [opened] + workflow_dispatch: + inputs: + pr_number: + description: 'PR number to review' + required: true + type: number + +permissions: + contents: read + pull-requests: write + +concurrency: + group: review-pr-${{ github.event.inputs.pr_number || github.event.number }} + cancel-in-progress: true + +jobs: + review: + timeout-minutes: 10 + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Process PR + uses: polka-codes/action@master + with: + pr_number: ${{ github.event.inputs.pr_number || github.event.number }} + review: true + env: + POLKA_API_PROVIDER: google + POLKA_MODEL: gemini-3.0-pro + GITHUB_TOKEN: ${{ github.token }} + POLKA_API_KEY: ${{ secrets.GEMINI_API_KEY }} + POLKA_BUDGET: 5 + From e4f14e9c3932b6f6fab6b165f304a21599421e71 Mon Sep 17 00:00:00 2001 From: Bryan Chen Date: Mon, 1 Dec 2025 15:58:00 +1300 Subject: [PATCH 2/3] update --- .config/review.polkacodes.yml | 10 ++++++++++ .github/workflows/ai-review.yml | 7 ++++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 .config/review.polkacodes.yml diff --git a/.config/review.polkacodes.yml b/.config/review.polkacodes.yml new file mode 100644 index 0000000000000..d5fcb633c7663 --- /dev/null +++ b/.config/review.polkacodes.yml @@ -0,0 +1,10 @@ +rules: + - repo: polka-codes/prompts + path: review/preamble.md + branch: master + - repo: polka-codes/prompts + path: review/rust.md + branch: master + - repo: polka-codes/prompts + path: review/polkadot-sdk.md + branch: master diff --git a/.github/workflows/ai-review.yml b/.github/workflows/ai-review.yml index fc3547910b54d..6d0ee67501c86 100644 --- a/.github/workflows/ai-review.yml +++ b/.github/workflows/ai-review.yml @@ -2,7 +2,7 @@ name: AI PR Review on: # pull_request: # enable this when we think this is ready - # types: [opened] + # types: [opened, ready_for_review] workflow_dispatch: inputs: pr_number: @@ -29,13 +29,14 @@ jobs: fetch-depth: 0 - name: Process PR - uses: polka-codes/action@master + uses: polka-codes/action@v2 with: pr_number: ${{ github.event.inputs.pr_number || github.event.number }} review: true + config: .config/review.polkacodes.yml env: POLKA_API_PROVIDER: google - POLKA_MODEL: gemini-3.0-pro + POLKA_MODEL: gemini-3-pro-preview GITHUB_TOKEN: ${{ github.token }} POLKA_API_KEY: ${{ secrets.GEMINI_API_KEY }} POLKA_BUDGET: 5 From afa43c2dd27a5f7a79192d523c3ffea9e1f02982 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Thu, 11 Dec 2025 22:22:17 +0100 Subject: [PATCH 3/3] Fix command output generation and downloading --- .github/scripts/cmd/cmd.py | 2 +- .github/workflows/cmd-run.yml | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/scripts/cmd/cmd.py b/.github/scripts/cmd/cmd.py index 9614f332a1368..c1887660e27cd 100755 --- a/.github/scripts/cmd/cmd.py +++ b/.github/scripts/cmd/cmd.py @@ -545,7 +545,7 @@ def main(): # Output labels as JSON for GitHub Action import json labels_output = {"labels": final_labels} - print(f"LABELS_JSON: {json.dumps(labels_output)}") + print_and_log(f"LABELS_JSON: {json.dumps(labels_output)}") except ValueError as e: print_and_log(f'❌ {e}') diff --git a/.github/workflows/cmd-run.yml b/.github/workflows/cmd-run.yml index 7e4abfd76beff..3f882e34c0aa7 100644 --- a/.github/workflows/cmd-run.yml +++ b/.github/workflows/cmd-run.yml @@ -293,12 +293,19 @@ jobs: repository: ${{ env.REPO }} ref: ${{ env.PR_BRANCH }} - - name: Download all artifacts + - name: Download command-diff artifact uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 with: name: command-diff path: command-diff + - name: Download command-output artifact + if: startsWith(github.event.inputs.cmd, 'label') + uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 + with: + name: command-output + path: command-output + - name: Apply labels for label command if: startsWith(github.event.inputs.cmd, 'label') uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0 @@ -310,7 +317,7 @@ jobs: let labels = []; try { - const output = fs.readFileSync('/tmp/cmd/command_output.log', 'utf8'); + const output = fs.readFileSync('command-output/command_output.log', 'utf8'); // Parse JSON labels from output - look for "LABELS_JSON: {...}" const jsonMatch = output.match(/LABELS_JSON: (.+)/);