name: OpenHands Build on: workflow_dispatch: inputs: task: description: 'Task to execute' required: true type: string workspace_path: description: 'Path to project workspace' required: true type: string retry_count: description: 'Retry attempt number' required: false type: number default: 0 project_type: description: 'Type of project (nodejs, python, etc.)' required: false type: string default: 'nodejs' permissions: contents: write pull-requests: write jobs: build: runs-on: ubuntu-latest env: TASK: ${{ github.event.inputs.task }} WORKSPACE_PATH: ${{ github.event.inputs.workspace_path }} RETRY_COUNT: ${{ github.event.inputs.retry_count || 0 }} PROJECT_TYPE: ${{ github.event.inputs.project_type || 'nodejs' }} LLM_MODEL: anthropic/claude-sonnet-4-5-20250929 steps: - name: Checkout repository uses: actions/checkout@v4 with: path: ${{ env.WORKSPACE_PATH }} - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.12' - name: Install uv uses: astral-sh/setup-uv@v6 with: enable-cache: true - name: Install OpenHands SDK run: | echo "Installing OpenHands SDK..." uv pip install --system "openhands-sdk @ git+https://github.com/OpenHands/agent-sdk.git@main#subdirectory=openhands-sdk" uv pip install --system "openhands-tools @ git+https://github.com/OpenHands/agent-sdk.git@main#subdirectory=openhands-tools" - name: Setup project dependencies run: | cd ${{ env.WORKSPACE_PATH }} if [ -f "package.json" ]; then echo "Installing Node.js dependencies..." npm ci elif [ -f "requirements.txt" ]; then echo "Installing Python dependencies..." uv pip install -r requirements.txt elif [ -f "pyproject.toml" ]; then echo "Installing Python project dependencies..." uv pip install -e . fi - name: Run OpenHands Build env: LLM_API_KEY: ${{ secrets.LLM_API_KEY }} RETRY_COUNT: ${{ env.RETRY_COUNT }} PROJECT_TYPE: ${{ env.PROJECT_TYPE }} run: | cd ${{ env.WORKSPACE_PATH }} echo "Starting OpenHands build..." echo "Attempt: ${{ env.RETRY_COUNT }}" echo "Workspace: $(pwd)" uv run python ../agent_script.py BUILD_EXIT_CODE=$? echo "Build exit code: $BUILD_EXIT_CODE" exit $BUILD_EXIT_CODE - name: Upload Build Logs uses: actions/upload-artifact@v4 if: always() with: name: build-logs-${{ github.run_number }} path: | *.log build-errors.json build-report.json retention-days: 7 - name: Upload Test Results if: always() uses: actions/upload-artifact@v4 with: name: test-results-${{ github.run_number }} path: | test-results/ coverage/ dist/ build/ retention-days: 30 - name: Upload node_modules cache if: always() uses: actions/upload-artifact@v4 with: name: node-modules-${{ github.run_number }} path: | node_modules/ retention-days: 1 - name: Build Summary if: always() run: | echo "## Build Results" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY if [ -f "build-report.json" ]; then echo "### Build Report" >> $GITHUB_STEP_SUMMARY cat build-report.json >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY fi if [ -f "build-errors.json" ]; then echo "### Build Errors" >> $GITHUB_STEP_SUMMARY cat build-errors.json >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY fi