From 509f775ab08fa7de6abb68e0a68bb97754207c2a Mon Sep 17 00:00:00 2001 From: Pranav M S Date: Tue, 6 Oct 2026 02:36:16 +0530 Subject: [PATCH 1/2] Add CODEOWNERS and Claude Code PR review workflow Claude reviews each non-draft PR (only new commits on subsequent pushes), then approves or requests changes for critical issues. Code owners are requested as reviewers on every run. Co-Authored-By: Claude Opus 5.5 --- .github/CODEOWNERS | 2 + .github/workflows/claude-review.yml | 95 +++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/claude-review.yml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..95dd627 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# Default owner for everything in the repository. +* @pranavms13 diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml new file mode 100644 index 0000000..236779c --- /dev/null +++ b/.github/workflows/claude-review.yml @@ -0,0 +1,95 @@ +name: Claude Code Review + +# Reviews every non-draft PR with Claude Code. On new pushes it reviews only the +# commits added since the last run, then approves or requests changes (critical +# issues only). Code owners from .github/CODEOWNERS are (re-)requested as reviewers. +# +# Requires the ANTHROPIC_API_KEY repository secret. +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +concurrency: + group: claude-review-${{ github.event.pull_request.number }} + cancel-in-progress: true + +permissions: + contents: read + pull-requests: write + +jobs: + request-codeowners: + # Fork PRs get a read-only token, so they can't request reviewers. + if: >- + !github.event.pull_request.draft && + github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + steps: + - name: Request review from code owners + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + PR: ${{ github.event.pull_request.number }} + AUTHOR: ${{ github.event.pull_request.user.login }} + BASE: ${{ github.event.pull_request.base.ref }} + run: | + # Read CODEOWNERS from the base branch so a PR can't rewrite its own reviewers. + owners=$(gh api "repos/$REPO/contents/.github/CODEOWNERS?ref=$BASE" --jq .content | base64 -d \ + | sed 's/#.*//' | grep -oE '@[A-Za-z0-9-]+(/[A-Za-z0-9_.-]+)?' | grep -v '/' | tr -d '@' | sort -u) + for owner in $owners; do + if [ "${owner,,}" = "${AUTHOR,,}" ]; then + echo "Skipping $owner (PR author)" + continue + fi + gh pr edit "$PR" --repo "$REPO" --add-reviewer "$owner" + done + + review: + # Secrets aren't available to fork PRs, so only review branches in this repo. + if: >- + !github.event.pull_request.draft && + github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: anthropics/claude-code-action@v1 + with: + anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + github_token: ${{ secrets.GITHUB_TOKEN }} + prompt: | + REPO: ${{ github.repository }} + PR NUMBER: ${{ github.event.pull_request.number }} + EVENT: ${{ github.event.action }} + PREVIOUS HEAD: ${{ github.event.before }} + CURRENT HEAD: ${{ github.event.pull_request.head.sha }} + + You are reviewing a pull request for OpenScreenStudio, a Tauri (Rust + React/TypeScript) + screen recording app. Read AGENTS.md first for project conventions. + + ## Scope + - If EVENT is "synchronize" and `git cat-file -e ` succeeds, review only the + new changes: `git diff `. Use `gh pr diff` and the surrounding + code for context, but don't re-raise issues in code these commits didn't touch. + - Otherwise (new PR, reopened, ready for review, or a force-push), review the whole PR via `gh pr diff`. + + ## What to look for + Focus on correctness: logic bugs, crashes/panics, data loss, race conditions, resource leaks, + security problems, broken builds, and behaviour that contradicts the PR description. + Ignore pure style nits and anything a formatter or linter would catch. + Verify each issue against the actual code before reporting it, and skip anything speculative. + + ## Output + 1. Post each concrete issue as an inline comment on the relevant line with + `mcp__github_inline_comment__create_inline_comment`. Mark critical ones with "**Critical:**". + 2. Then submit exactly one review with `gh pr review --repo `: + - `--request-changes` only if you found at least one CRITICAL issue: something that would + ship a bug, crash, data loss, security hole, or broken build. The body lists those issues. + - `--approve` otherwise. The body is a short summary of what changed and any non-blocking notes. + Keep the review body concise, and say whether it covers the full PR or only the new commits. + claude_args: | + --model claude-opus-5-5 + --allowedTools "Read,Glob,Grep,mcp__github_inline_comment__create_inline_comment,Bash(gh pr view:*),Bash(gh pr diff:*),Bash(gh pr review:*),Bash(git diff:*),Bash(git log:*),Bash(git show:*),Bash(git cat-file:*)" From 58ed549e714156407dfa18d56b56fbed002c2399 Mon Sep 17 00:00:00 2001 From: Pranav M S Date: Tue, 6 Oct 2026 02:45:20 +0530 Subject: [PATCH 2/2] Remove Claude Code review workflow It's being added in a separate PR; this PR now only adds CODEOWNERS. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/claude-review.yml | 95 ----------------------------- 1 file changed, 95 deletions(-) delete mode 100644 .github/workflows/claude-review.yml diff --git a/.github/workflows/claude-review.yml b/.github/workflows/claude-review.yml deleted file mode 100644 index 236779c..0000000 --- a/.github/workflows/claude-review.yml +++ /dev/null @@ -1,95 +0,0 @@ -name: Claude Code Review - -# Reviews every non-draft PR with Claude Code. On new pushes it reviews only the -# commits added since the last run, then approves or requests changes (critical -# issues only). Code owners from .github/CODEOWNERS are (re-)requested as reviewers. -# -# Requires the ANTHROPIC_API_KEY repository secret. -on: - pull_request: - types: [opened, synchronize, reopened, ready_for_review] - -concurrency: - group: claude-review-${{ github.event.pull_request.number }} - cancel-in-progress: true - -permissions: - contents: read - pull-requests: write - -jobs: - request-codeowners: - # Fork PRs get a read-only token, so they can't request reviewers. - if: >- - !github.event.pull_request.draft && - github.event.pull_request.head.repo.full_name == github.repository - runs-on: ubuntu-latest - steps: - - name: Request review from code owners - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REPO: ${{ github.repository }} - PR: ${{ github.event.pull_request.number }} - AUTHOR: ${{ github.event.pull_request.user.login }} - BASE: ${{ github.event.pull_request.base.ref }} - run: | - # Read CODEOWNERS from the base branch so a PR can't rewrite its own reviewers. - owners=$(gh api "repos/$REPO/contents/.github/CODEOWNERS?ref=$BASE" --jq .content | base64 -d \ - | sed 's/#.*//' | grep -oE '@[A-Za-z0-9-]+(/[A-Za-z0-9_.-]+)?' | grep -v '/' | tr -d '@' | sort -u) - for owner in $owners; do - if [ "${owner,,}" = "${AUTHOR,,}" ]; then - echo "Skipping $owner (PR author)" - continue - fi - gh pr edit "$PR" --repo "$REPO" --add-reviewer "$owner" - done - - review: - # Secrets aren't available to fork PRs, so only review branches in this repo. - if: >- - !github.event.pull_request.draft && - github.event.pull_request.head.repo.full_name == github.repository - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - uses: anthropics/claude-code-action@v1 - with: - anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} - github_token: ${{ secrets.GITHUB_TOKEN }} - prompt: | - REPO: ${{ github.repository }} - PR NUMBER: ${{ github.event.pull_request.number }} - EVENT: ${{ github.event.action }} - PREVIOUS HEAD: ${{ github.event.before }} - CURRENT HEAD: ${{ github.event.pull_request.head.sha }} - - You are reviewing a pull request for OpenScreenStudio, a Tauri (Rust + React/TypeScript) - screen recording app. Read AGENTS.md first for project conventions. - - ## Scope - - If EVENT is "synchronize" and `git cat-file -e ` succeeds, review only the - new changes: `git diff `. Use `gh pr diff` and the surrounding - code for context, but don't re-raise issues in code these commits didn't touch. - - Otherwise (new PR, reopened, ready for review, or a force-push), review the whole PR via `gh pr diff`. - - ## What to look for - Focus on correctness: logic bugs, crashes/panics, data loss, race conditions, resource leaks, - security problems, broken builds, and behaviour that contradicts the PR description. - Ignore pure style nits and anything a formatter or linter would catch. - Verify each issue against the actual code before reporting it, and skip anything speculative. - - ## Output - 1. Post each concrete issue as an inline comment on the relevant line with - `mcp__github_inline_comment__create_inline_comment`. Mark critical ones with "**Critical:**". - 2. Then submit exactly one review with `gh pr review --repo `: - - `--request-changes` only if you found at least one CRITICAL issue: something that would - ship a bug, crash, data loss, security hole, or broken build. The body lists those issues. - - `--approve` otherwise. The body is a short summary of what changed and any non-blocking notes. - Keep the review body concise, and say whether it covers the full PR or only the new commits. - claude_args: | - --model claude-opus-5-5 - --allowedTools "Read,Glob,Grep,mcp__github_inline_comment__create_inline_comment,Bash(gh pr view:*),Bash(gh pr diff:*),Bash(gh pr review:*),Bash(git diff:*),Bash(git log:*),Bash(git show:*),Bash(git cat-file:*)"