Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 36 additions & 6 deletions .github/workflows/opencode-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ name: OpenCode PR Review
on:
pull_request:
types: [opened, synchronize]
# Skip review for documentation-only changes
# Skip review for documentation and config-only changes
# Exclude this workflow file to prevent self-triggering loops
paths-ignore:
- "**/*.md"
- ".github/workflows/opencode-review.yml"
- ".gitignore"
- "pyproject.toml"

# Cancel in-progress runs for the same PR to avoid duplicate reviews
concurrency:
Expand All @@ -29,10 +30,10 @@ jobs:
- name: Calculate total changes
id: calc
run: |
additions="${{ github.event.pull_request.additions }}"
deletions="${{ github.event.pull_request.deletions }}"
additions=${{ github.event.pull_request.additions }}
deletions=${{ github.event.pull_request.deletions }}
total=$((additions + deletions))
echo "total=$total" >> "$GITHUB_OUTPUT"
echo "total=$total" >> $GITHUB_OUTPUT
Comment thread
frankbria marked this conversation as resolved.

- name: Checkout repository
# Only review substantial changes (5+ files OR 20+ lines changed)
Expand All @@ -44,6 +45,31 @@ jobs:
fetch-depth: 1
persist-credentials: false

- name: Clear git credentials to avoid duplicate auth
if: |
github.event.pull_request.changed_files >= 5 ||
steps.calc.outputs.total >= 20
run: |
# Clear all GitHub-related git config to prevent auth conflicts
git config --global --unset-all http.https://github.com/.extraheader || true
git config --local --unset-all http.https://github.com/.extraheader || true
git config --global --unset-all credential.helper || true
git config --local --unset-all credential.helper || true
git config --global --unset-all credential."https://github.com".helper || true
git config --local --unset-all credential."https://github.com".helper || true
# Remove any credential URLs
git config --global --unset-all credential.url || true
git config --local --unset-all credential.url || true
# Clear any includeIf configs that might add credentials
# Note: git config doesn't support wildcards, so we iterate over matching keys
# Use case-insensitive grep to catch both "includeIf" and "includeif"
for key in $(git config --global --list --name-only 2>/dev/null | grep -i "^includeif\." || true); do
git config --global --unset "$key" || true
done
for key in $(git config --local --list --name-only 2>/dev/null | grep -i "^includeif\." || true); do
git config --local --unset "$key" || true
done

- name: Run OpenCode PR Review
# Only review substantial changes (5+ files OR 20+ lines changed)
if: |
Expand All @@ -53,14 +79,18 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }}
# Pass PR context as environment variables for the review
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BODY: ${{ github.event.pull_request.body }}
REPO_NAME: ${{ github.repository }}
Comment thread
frankbria marked this conversation as resolved.
with:
model: zai-coding-plan/glm-4.7
use_github_token: true
prompt: |
You are reviewing PR #${{ github.event.pull_request.number }} in repository ${{ github.repository }}.

Use `gh pr view ${{ github.event.pull_request.number }}` to read the PR title and description.
Use `gh pr diff ${{ github.event.pull_request.number }}` to read the changed files.
PR TITLE: ${{ github.event.pull_request.title }}

Please review this pull request and provide feedback on:
- Code quality and best practices
Expand Down
2 changes: 2 additions & 0 deletions codeframe/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ def version():
from codeframe.cli.session_commands import session_app # noqa: E402
from codeframe.cli.context_commands import context_app # noqa: E402
from codeframe.cli.review_commands import review_app # noqa: E402
from codeframe.cli.pr_commands import pr_app # noqa: E402

# Register Phase 1 command groups
app.add_typer(auth_app, name="auth", help="Authentication (login, logout, register)")
Expand All @@ -332,6 +333,7 @@ def version():
app.add_typer(session_app, name="session", help="Session management (get)")
app.add_typer(context_app, name="context", help="Agent context (get, stats, flash-save, checkpoints)")
app.add_typer(review_app, name="review", help="Code review management (status, stats, findings, list)")
app.add_typer(pr_app, name="pr", help="Pull request management (create, list, merge, close)")


if __name__ == "__main__":
Expand Down
2 changes: 2 additions & 0 deletions codeframe/cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

# Import auth subapp for credential management
from codeframe.cli.auth_commands import auth_app
from codeframe.cli.pr_commands import pr_app

# Load environment variables from .env files
# Priority: workspace .env > home .env
Expand Down Expand Up @@ -4160,6 +4161,7 @@ def templates_apply(
app.add_typer(schedule_app, name="schedule")
app.add_typer(templates_app, name="templates")
app.add_typer(auth_app, name="auth")
app.add_typer(pr_app, name="pr")


# =============================================================================
Expand Down
Loading
Loading