# Assign Reviews

> Automate PR management with intelligent reviewer assignment and workflow notifications using OpenHands Agent

<Note>
  This example is available on GitHub: [examples/03\_github\_workflows/01\_basic\_action/assign-reviews.yml](https://github.com/OpenHands/software-agent-sdk/blob/main/examples/03_github_workflows/01_basic_action/assign-reviews.yml)
</Note>

Automate pull request triage by intelligently assigning reviewers based on git blame analysis, notifying reviewers of pending PRs, and prompting authors on stale pull requests. The agent performs three sequential checks: pinging reviewers on clean PRs awaiting review (3+ days), reminding authors on stale PRs (5+ days), and auto-assigning reviewers based on code ownership for unassigned PRs.

## How it works

It relies on the basic action workflow (`01_basic_action`) which provides a flexible template for running arbitrary agent tasks in GitHub Actions.

**Core Components:**

* **`agent_script.py`** - Python script that initializes the OpenHands agent with configurable LLM settings and executes tasks based on provided prompts
* **`workflow.yml`** - GitHub Actions workflow that sets up the environment, installs dependencies, and runs the agent

**Prompt Options:**

1. **`PROMPT_STRING`** - Direct inline text for simple prompts (used in this example)
2. **`PROMPT_LOCATION`** - URL or file path for external prompts

The workflow downloads the agent script, validates configuration, runs the task, and uploads execution logs as artifacts.

## Assign Reviews Use Case

This specific implementation uses the basic action template to handle three PR management scenarios:

**1. Need Reviewer Action**

* Identifies PRs waiting for review
* Notifies reviewers to take action

**2. Need Author Action**

* Finds stale PRs with no activity for 5+ days
* Prompts authors to update, request review, or close

**3. Need Reviewers**

* Detects non-draft PRs without assigned reviewers (created 1+ day ago, CI passing)
* Uses git blame analysis to identify relevant contributors
* Automatically assigns reviewers based on file ownership and contribution history
* Balances reviewer workload across team members

## Quick Start

```bash  theme={null}
# 1. Copy workflow to your repository
cp examples/03_github_workflows/01_basic_action/assign-reviews.yml .github/workflows/assign-reviews.yml

# 2. Configure secrets in GitHub Settings → Secrets → Actions
# Add: LLM_API_KEY (get from https://docs.openhands.dev/openhands/usage/llms/openhands-llms)

# 3. Configure GitHub Actions permissions
# Settings → Actions → General → Workflow permissions
# Enable: "Read and write permissions"

# 4. (Optional) Customize the schedule in the workflow file
# Default: Daily at 12 PM UTC
```

## Features

* **Intelligent Assignment** - Uses git blame to identify relevant reviewers based on code ownership
* **Automated Notifications** - Sends contextual reminders to reviewers and authors
* **Workload Balancing** - Distributes review requests evenly across team members
* **Scheduled & Manual** - Runs daily automatically or on-demand via workflow dispatch

## Related Files

* [Agent Script](https://github.com/OpenHands/software-agent-sdk/blob/main/examples/03_github_workflows/01_basic_action/agent_script.py)
* [Workflow File](https://github.com/OpenHands/software-agent-sdk/blob/main/examples/03_github_workflows/01_basic_action/assign-reviews.yml)
* [Basic Action README](https://github.com/OpenHands/software-agent-sdk/blob/main/examples/03_github_workflows/01_basic_action/README.md)


---

> To find navigation and other pages in this documentation, fetch the llms.txt file at: https://docs.openhands.dev/llms.txt