Repository navigation
refactor: Use composite GitHub Action for PR review workflow #1927
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
4864ff2
9318dde
24ba17a
7393a5a
fcec737
5614298
983b44f
d510dbd
256a944
7c29c92
a0ac453
55d19b2
35f5d0a
8097053
62db20a
da2095e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,142 @@ | ||||||||
| --- | ||||||||
| name: OpenHands PR Review | ||||||||
| description: Automated PR review using OpenHands agent | ||||||||
| author: OpenHands | ||||||||
|
|
||||||||
| branding: | ||||||||
| icon: code | ||||||||
| color: blue | ||||||||
|
|
||||||||
| inputs: | ||||||||
| llm-model: | ||||||||
| description: LLM model to use for the review | ||||||||
| required: false | ||||||||
| default: anthropic/claude-sonnet-4-5-20250929 | ||||||||
| llm-base-url: | ||||||||
| description: LLM base URL (optional, for custom LLM endpoints) | ||||||||
| required: false | ||||||||
| default: '' | ||||||||
| review-style: | ||||||||
| description: "Review style: 'standard' or 'roasted'" | ||||||||
| required: false | ||||||||
| default: standard | ||||||||
| sdk-version: | ||||||||
| description: SDK version tag or branch name to use (e.g., v1.0.0 or main) | ||||||||
| required: false | ||||||||
| default: main | ||||||||
|
enyst marked this conversation as resolved.
|
||||||||
| use-pr-branch-for-sdk: | ||||||||
| description: When true and reviewing a PR on the SDK repo itself, use the PR's head branch instead of sdk-version | ||||||||
| required: false | ||||||||
| default: 'false' | ||||||||
| llm-api-key: | ||||||||
| description: LLM API key (required) | ||||||||
| required: true | ||||||||
| github-token: | ||||||||
| description: GitHub token for API access (required) | ||||||||
| required: true | ||||||||
|
enyst marked this conversation as resolved.
|
||||||||
|
|
||||||||
| runs: | ||||||||
| using: composite | ||||||||
| steps: | ||||||||
| - name: Determine SDK ref to use | ||||||||
| id: sdk-ref | ||||||||
| shell: bash | ||||||||
| run: | | ||||||||
| # If use-pr-branch-for-sdk is true and we're reviewing a PR on the SDK repo itself, | ||||||||
| # use the PR's head branch instead of the sdk-version input | ||||||||
| if [ "${{ inputs.use-pr-branch-for-sdk }}" = "true" ] && [ "${{ github.repository }}" = "OpenHands/software-agent-sdk" ]; then | ||||||||
| echo "ref=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT | ||||||||
| echo "Using PR branch '${{ github.event.pull_request.head.ref }}' for SDK (reviewing SDK repo PR)" | ||||||||
| else | ||||||||
| echo "ref=${{ inputs.sdk-version }}" >> $GITHUB_OUTPUT | ||||||||
| echo "Using sdk-version '${{ inputs.sdk-version }}' for SDK" | ||||||||
| fi | ||||||||
|
|
||||||||
| - name: Checkout software-agent-sdk repository | ||||||||
| uses: actions/checkout@v4 | ||||||||
| with: | ||||||||
| repository: OpenHands/software-agent-sdk | ||||||||
| ref: ${{ steps.sdk-ref.outputs.ref }} | ||||||||
| path: software-agent-sdk | ||||||||
|
|
||||||||
| - name: Checkout PR repository | ||||||||
| uses: actions/checkout@v4 | ||||||||
| with: | ||||||||
| repository: ${{ github.event.pull_request.head.repo.full_name }} | ||||||||
| ref: ${{ github.event.pull_request.head.ref }} | ||||||||
| fetch-depth: 0 | ||||||||
| persist-credentials: false | ||||||||
| path: pr-repo | ||||||||
|
|
||||||||
| - name: Set up Python | ||||||||
| uses: actions/setup-python@v5 | ||||||||
| with: | ||||||||
| python-version: '3.13' | ||||||||
|
xingyaoww marked this conversation as resolved.
Outdated
|
||||||||
|
|
||||||||
| - name: Install uv | ||||||||
| uses: astral-sh/setup-uv@v6 | ||||||||
| with: | ||||||||
| enable-cache: true | ||||||||
|
|
||||||||
| - name: Install GitHub CLI | ||||||||
| shell: bash | ||||||||
| run: | | ||||||||
| sudo apt-get update | ||||||||
| sudo apt-get install -y gh | ||||||||
|
|
||||||||
| - name: Install OpenHands dependencies | ||||||||
| shell: bash | ||||||||
| run: | | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟢 Nit: Using
Suggested change
|
||||||||
| uv pip install --system ./software-agent-sdk/openhands-sdk ./software-agent-sdk/openhands-tools | ||||||||
|
|
||||||||
| - name: Check required configuration | ||||||||
| shell: bash | ||||||||
| env: | ||||||||
| LLM_API_KEY: ${{ inputs.llm-api-key }} | ||||||||
| GITHUB_TOKEN: ${{ inputs.github-token }} | ||||||||
| run: | | ||||||||
| if [ -z "$LLM_API_KEY" ]; then | ||||||||
| echo "Error: llm-api-key is required." | ||||||||
| exit 1 | ||||||||
| fi | ||||||||
| if [ -z "$GITHUB_TOKEN" ]; then | ||||||||
| echo "Error: github-token is required." | ||||||||
| exit 1 | ||||||||
| fi | ||||||||
|
|
||||||||
| echo "PR Number: ${{ github.event.pull_request.number }}" | ||||||||
| echo "PR Title: ${{ github.event.pull_request.title }}" | ||||||||
| echo "Repository: ${{ github.repository }}" | ||||||||
| echo "SDK Version: ${{ inputs.sdk-version }}" | ||||||||
| echo "LLM model: ${{ inputs.llm-model }}" | ||||||||
| if [ -n "${{ inputs.llm-base-url }}" ]; then | ||||||||
| echo "LLM base URL: ${{ inputs.llm-base-url }}" | ||||||||
| fi | ||||||||
|
|
||||||||
| - name: Run PR review | ||||||||
| shell: bash | ||||||||
| env: | ||||||||
| LLM_MODEL: ${{ inputs.llm-model }} | ||||||||
| LLM_BASE_URL: ${{ inputs.llm-base-url }} | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟢 Nit: Empty string for |
||||||||
| REVIEW_STYLE: ${{ inputs.review-style }} | ||||||||
| LLM_API_KEY: ${{ inputs.llm-api-key }} | ||||||||
| GITHUB_TOKEN: ${{ inputs.github-token }} | ||||||||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||||||||
| PR_TITLE: ${{ github.event.pull_request.title }} | ||||||||
| PR_BODY: ${{ github.event.pull_request.body }} | ||||||||
| PR_BASE_BRANCH: ${{ github.event.pull_request.base.ref }} | ||||||||
| PR_HEAD_BRANCH: ${{ github.event.pull_request.head.ref }} | ||||||||
| REPO_NAME: ${{ github.repository }} | ||||||||
| run: | | ||||||||
| cd pr-repo | ||||||||
| uv run python ../software-agent-sdk/examples/03_github_workflows/02_pr_review/agent_script.py | ||||||||
|
|
||||||||
| - name: Upload logs as artifact | ||||||||
| uses: actions/upload-artifact@v4 | ||||||||
| if: always() | ||||||||
| with: | ||||||||
| name: openhands-pr-review-logs | ||||||||
| path: | | ||||||||
| *.log | ||||||||
| output/ | ||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 Critical: The artifact paths are incorrect. The script runs with Fix:
Suggested change
|
||||||||
| retention-days: 7 | ||||||||
|
xingyaoww marked this conversation as resolved.
|
Uh oh!
There was an error while loading. Please reload this page.