Skip to content

Release v2.6.0: Answer API, Speakeasy removal, flattened API surface #77

Release v2.6.0: Answer API, Speakeasy removal, flattened API surface

Release v2.6.0: Answer API, Speakeasy removal, flattened API surface #77

Workflow file for this run

name: Droid Auto Review
on:
pull_request:
types: [opened, ready_for_review, reopened, synchronize]
workflow_dispatch:
inputs:
pr_number:
description: "Pull request number to review (for external contributors)"
required: true
type: number
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || inputs.pr_number }}
cancel-in-progress: true
jobs:
droid-review:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read
steps:
- name: Check if internal contributor
id: check_internal
if: github.event_name == 'pull_request'
run: |
RESPONSE=$(gh api repos/${{ github.repository }}/collaborators/${{ github.event.pull_request.user.login }}/permission 2>/dev/null || echo '{"permission":"none"}')
PERMISSION=$(echo "$RESPONSE" | jq -r '.permission')
echo "Author permission: $PERMISSION"
if [[ "$PERMISSION" != "admin" && "$PERMISSION" != "maintain" && "$PERMISSION" != "write" ]]; then
echo "Skipping auto-review for external contributor (permission: $PERMISSION)"
echo "Use 'Actions > Droid Auto Review > Run workflow' to manually trigger review"
echo "is_internal=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "Author is internal contributor, proceeding with review"
echo "is_internal=true" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ github.token }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Run Droid Auto Review (internal)
if: github.event_name == 'pull_request' && steps.check_internal.outputs.is_internal == 'true'
uses: Factory-AI/droid-action@v5
with:
factory_api_key: ${{ secrets.FACTORY_API_KEY }}
automatic_review: true
automatic_security_review: true
allowed_bots: "claude[bot],github-advanced-security[bot]"
- name: Checkout PR branch
if: github.event_name == 'workflow_dispatch'
run: gh pr checkout "$PR_NUMBER"
env:
PR_NUMBER: ${{ inputs.pr_number }}
GH_TOKEN: ${{ github.token }}
- name: Install Droid CLI
if: github.event_name == 'workflow_dispatch'
run: |
# Official Factory CLI installer from app.factory.ai
# TODO: pin to a specific version with checksum verification
curl --retry 5 --retry-delay 2 --retry-all-errors -fsSL https://app.factory.ai/cli | sh
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Run Droid Review (external)
if: github.event_name == 'workflow_dispatch'
run: |
droid exec --auto high "/review $GITHUB_REPOSITORY/pull/$PR_NUMBER"
env:
PR_NUMBER: ${{ inputs.pr_number }}
GITHUB_REPOSITORY: ${{ github.repository }}
FACTORY_API_KEY: ${{ secrets.FACTORY_API_KEY }}
GITHUB_TOKEN: ${{ github.token }}