Files
OpenHands/.github/workflows/pr-review-by-openhands.yml
2026-02-20 18:44:02 +00:00

68 lines
3.1 KiB
YAML

---
name: PR Review by OpenHands
on:
# Use pull_request_target so this workflow can use secrets in the base repo context.
# Security: This workflow runs when:
# 1. A non-draft PR is opened by a collaborator/member/owner, OR
# 2. A draft PR is marked ready_for_review by a collaborator/member/owner, OR
# 3. openhands-agent or all-hands-bot is requested as a reviewer on a PR from a
# collaborator/member/owner, OR
# 4. A maintainer adds the 'review-this' label (manual trigger for external authors)
# Note: PR authors (including from forks) can request reviewers, but this workflow
# will only auto-run when the PR author is collaborator/member/owner.
# For external authors, a maintainer can trigger it by applying the 'review-this' label.
# The PR code is explicitly checked out for review, but secrets are only accessible
# because the workflow runs in the base repository context.
pull_request_target:
types: [opened, ready_for_review, labeled, review_requested]
permissions:
contents: read
pull-requests: write
issues: write
jobs:
pr-review:
# Run when one of the following conditions is met:
# 1. A new non-draft PR is opened by a collaborator/member/owner, OR
# 2. A draft PR is converted to ready for review by a collaborator/member/owner, OR
# 3. openhands-agent or all-hands-bot is requested as a reviewer on a PR from a
# collaborator/member/owner, OR
# 4. A maintainer adds the 'review-this' label (manual trigger for external authors)
if: |
(
(
(
(
github.event.action == 'opened' &&
github.event.pull_request.draft == false
) ||
(github.event.action == 'ready_for_review') ||
(
github.event.action == 'review_requested' &&
(
github.event.requested_reviewer.login == 'openhands-agent' ||
github.event.requested_reviewer.login == 'all-hands-bot'
)
)
) && contains(fromJSON('["COLLABORATOR","MEMBER","OWNER"]'), github.event.pull_request.author_association)
) || (
github.event.action == 'labeled' && github.event.label.name == 'review-this'
)
)
concurrency:
group: pr-review-${{ github.event.pull_request.number }}
cancel-in-progress: true
runs-on: ubuntu-24.04
steps:
- name: Run PR Review
uses: OpenHands/extensions/plugins/pr-review@main
with:
llm-model: litellm_proxy/claude-sonnet-4-5-20250929
llm-base-url: https://llm-proxy.app.all-hands.dev
review-style: roasted
llm-api-key: ${{ secrets.LLM_API_KEY }}
github-token: ${{ secrets.ALLHANDS_BOT_GITHUB_PAT }}
lmnr-api-key: ${{ secrets.LMNR_SKILLS_API_KEY }}