Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
38 changes: 34 additions & 4 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,25 @@ on:
description: 'PR number to review'
required: true
type: number
review_mode:
description: 'Review mode (leave empty for all default modes)'
required: false
type: choice
options:
- ''
- security
- plan
- outsider
- deep
default: ''
linked_issue:
description: 'Linked issue number (for plan verification mode)'
required: false
type: number

jobs:
review:
name: AI Code Review
name: AI Code Review (${{ matrix.mode }})
runs-on: ubuntu-latest
# Skip draft PRs, bot PRs, and PRs with [skip-review] in title
# For workflow_dispatch, always run (manual trigger implies intent)
Expand All @@ -28,8 +43,15 @@ jobs:
contents: read
pull-requests: write

# Run all three default review modes in parallel
# For workflow_dispatch with specific mode, only that mode runs
strategy:
fail-fast: false
matrix:
mode: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.review_mode != '' && fromJson(format('["{0}"]', github.event.inputs.review_mode)) || fromJson('["security", "plan", "outsider"]') }}

concurrency:
group: egg-review-${{ github.event.pull_request.number || github.event.inputs.pr_number }}
group: egg-review-${{ github.event.pull_request.number || github.event.inputs.pr_number }}-${{ matrix.mode }}
cancel-in-progress: true

steps:
Expand Down Expand Up @@ -64,10 +86,17 @@ jobs:

- name: Build review prompt
id: prompt
run: bash action/build-review-prompt.sh
run: |
if [[ "$REVIEW_MODE" == "deep" ]]; then
bash action/build-deep-review-prompt.sh
else
bash action/build-review-prompt.sh
fi
env:
GH_TOKEN: ${{ steps.bot-token.outputs.token }}
PR_NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr_number }}
REVIEW_MODE: ${{ matrix.mode }}
LINKED_ISSUE: ${{ github.event.inputs.linked_issue }}

- name: Checkout PR branch
uses: actions/checkout@v4
Expand All @@ -91,7 +120,8 @@ jobs:
bot-app-private-key: ${{ secrets.BOT_APP_PRIVATE_KEY }}
bot-app-installation-id: ${{ secrets.BOT_APP_INSTALLATION_ID }}
bot-username: james-in-a-box
timeout: "10"
# Deep review gets 30min timeout, standard review gets 10min
timeout: ${{ steps.prompt.outputs.timeout || '10' }}

- name: Post review comments
if: always() && steps.egg.outputs.exit-code == '0'
Expand Down
5 changes: 5 additions & 0 deletions action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ inputs:
description: Docker image tag to use (e.g., v1.0.0 or latest)
required: false
default: latest
review-mode:
description: "Review mode: standard, security, plan, outsider, or deep"
required: false
default: standard

outputs:
exit-code:
Expand Down Expand Up @@ -78,5 +82,6 @@ runs:
INPUT_TIMEOUT: ${{ inputs.timeout }}
INPUT_MODEL: ${{ inputs.model }}
INPUT_IMAGE_TAG: ${{ inputs.image-tag }}
INPUT_REVIEW_MODE: ${{ inputs.review-mode }}
GITHUB_EVENT_REPOSITORY_VISIBILITY: ${{ github.event.repository.visibility }}
run: ${{ github.action_path }}/entrypoint.sh
Loading
Loading