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/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/ai-review.yml b/.github/workflows/ai-review.yml new file mode 100644 index 0000000000000..6d0ee67501c86 --- /dev/null +++ b/.github/workflows/ai-review.yml @@ -0,0 +1,43 @@ +name: AI PR Review + +on: + # pull_request: # enable this when we think this is ready + # types: [opened, ready_for_review] + 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@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-pro-preview + GITHUB_TOKEN: ${{ github.token }} + POLKA_API_KEY: ${{ secrets.GEMINI_API_KEY }} + POLKA_BUDGET: 5 + 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: (.+)/);