From c3493533b02cfb1eac5f74a268c7637ffcde75e0 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 13 Mar 2026 20:17:45 +0000 Subject: [PATCH] Remove duplicate pr-review-run.yml workflow and workflow_dispatch from pr-review.yml pr-review-run.yml is superseded by ai-persona-review.yml, which handles persona reviews triggered by workflow_run from pr-review.yml and also supports manual dispatch via workflow_dispatch. Removing the redundant file eliminates duplicate review runs on every PR. The workflow_dispatch trigger added to pr-review.yml in PR #204 is not needed there since manual invocation is already covered by ai-persona-review.yml. --- .github/workflows/pr-review-run.yml | 113 ---------------------------- .github/workflows/pr-review.yml | 1 - 2 files changed, 114 deletions(-) delete mode 100644 .github/workflows/pr-review-run.yml diff --git a/.github/workflows/pr-review-run.yml b/.github/workflows/pr-review-run.yml deleted file mode 100644 index a6b09a6f..00000000 --- a/.github/workflows/pr-review-run.yml +++ /dev/null @@ -1,113 +0,0 @@ -name: AI PR Review – Run - -# Triggered by the "AI PR Review" workflow_run so this job never checks out -# PR head code. The diff comes from a trusted artifact uploaded by the -# pull_request workflow. The ANTHROPIC_API_KEY is therefore never exposed -# to potentially malicious PR changes. -"on": - workflow_run: - workflows: ["AI PR Review"] - types: [completed] - -jobs: - review: - runs-on: ubuntu-latest - if: github.event.workflow_run.conclusion == 'success' - permissions: - actions: read - contents: read - pull-requests: write - steps: - # Checks out the BASE branch (trusted) — never the PR head. - - uses: actions/checkout@v4 - - # Check whether prepare-review uploaded an artifact. If it was skipped - # (no review-relevant files changed) there is nothing to do. - - name: Check for review artifact - id: check-artifact - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - count=$(gh api \ - "repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}/artifacts" \ - --jq '[.artifacts[] | select(.name == "pr-review-inputs")] | length') - if [ "$count" -gt 0 ]; then - echo "exists=true" >> "$GITHUB_OUTPUT" - else - echo "exists=false" >> "$GITHUB_OUTPUT" - echo "No pr-review-inputs artifact found — prepare-review was skipped. Nothing to review." - fi - - - name: Download review inputs - if: steps.check-artifact.outputs.exists == 'true' - uses: actions/download-artifact@v4 - with: - name: pr-review-inputs - run-id: ${{ github.event.workflow_run.id }} - github-token: ${{ secrets.GITHUB_TOKEN }} - - - name: Load review metadata - id: meta - if: steps.check-artifact.outputs.exists == 'true' - run: | - python3 - <<'PYEOF' - import json, os, re - with open("review-meta.json") as f: - d = json.load(f) - out = os.environ["GITHUB_OUTPUT"] - _safe_key = re.compile(r'^[A-Za-z0-9_-]+$') - with open(out, "a") as f: - for k, v in d.items(): - if not _safe_key.match(k): - continue # skip keys with unsafe characters - val = str(v).strip() - if any(c in val for c in ('\n', '\r', '\x00')): - f.write(f"{k}<> "$GITHUB_OUTPUT" - else - echo "available=false" >> "$GITHUB_OUTPUT" - fi - env: - ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} - - - name: Run AI persona reviews - if: steps.check-artifact.outputs.exists == 'true' && steps.check-key.outputs.available == 'true' - env: - ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} - REVIEW_MODEL: ${{ vars.REVIEW_MODEL || 'claude-haiku-4-5-20251001' }} - NEEDS_GUI: ${{ steps.meta.outputs.needs_gui }} - NEEDS_CONFIG: ${{ steps.meta.outputs.needs_config }} - NEEDS_API: ${{ steps.meta.outputs.needs_api }} - NEEDS_TEST: ${{ steps.meta.outputs.needs_test }} - DIFF_FILE: pr.diff - run: python3 .github/scripts/pr-review.py - - - name: Post review comment - if: steps.check-artifact.outputs.exists == 'true' && steps.check-key.outputs.available == 'true' && hashFiles('review_comment.txt') != '' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - if [ ! -s review_comment.txt ]; then - echo "review_comment.txt is empty — not posting." - exit 0 - fi - if [[ "$(head -c 4 review_comment.txt)" == "