# phurba-sherpa/ollama-pr-review-gh-action architecture

> Architecture diagram of the GitHub repository phurba-sherpa/ollama-pr-review-gh-action, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/phurba-sherpa/ollama-pr-review-gh-action
- Repository: https://github.com/phurba-sherpa/ollama-pr-review-gh-action

## Overview

This action reviews pull-request changes using an Ollama review model, optionally translates the result, and posts findings to the pull request. The main runtime path starts in `src/ollama_review.py`: it loads configuration, fetches changed files, formats eligible diffs, requests a model review, and handles the result. The README documents multilingual output and inline severity-based comments. Some calls in the omitted portions of the entry point cannot be verified, so those relationships are not asserted as direct source calls.

Main entry points: [`src/ollama_review.py`](https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/ollama_review.py) (Review entry point), [`src/config.py`](https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/config.py) (Prompt configuration), [`src/review.py`](https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/review.py) (Diff filtering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Action workflow"]
  node_entrypoint["Review entry point<br/>[ollama_review.py]"]
  node_config["Prompt configuration<br/>[config.py]"]
  node_fetch["Changed-file retrieval<br/>[ollama_review.py]"]
  node_posting["PR comment posting<br/>[ollama_review.py]"]
end

subgraph group_review["Review processing"]
  node_format["Diff filtering<br/>[review.py]"]
  node_prompt["Review prompt<br/>[ollama_review.py]"]
  node_model_lifecycle["Model lifecycle<br/>[ollama_review.py]"]
  node_response["Review validation<br/>[review.py]"]
  node_translation["Review translation<br/>[ollama_review.py]"]
end

subgraph group_integrations["External services"]
  node_review_model["Review model"]
  node_translation_model["Translation model"]
  node_github_api["GitHub API"]
end

node_github(("Pull request"))

node_github -->|"initiates review"| node_entrypoint
node_entrypoint -->|"loads prompt"| node_config
node_entrypoint -->|"requests review"| node_fetch
node_fetch -->|"fetches PR files"| node_github_api
node_entrypoint -->|"prepares model"| node_model_lifecycle
node_model_lifecycle -->|"manages model"| node_review_model
node_fetch -->|"formats changes"| node_format
node_entrypoint -->|"builds request"| node_prompt
node_prompt -->|"requests analysis"| node_review_model
node_entrypoint -->|"parses response"| node_response
node_entrypoint -.->|"translates output"| node_translation
node_translation -->|"requests translation"| node_translation_model
node_entrypoint -.->|"posts findings"| node_posting
node_posting -->|"creates PR review"| node_github_api

click node_entrypoint "https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/ollama_review.py"
click node_config "https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/config.py"
click node_fetch "https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/ollama_review.py"
click node_format "https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/review.py"
click node_prompt "https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/ollama_review.py"
click node_model_lifecycle "https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/ollama_review.py"
click node_response "https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/review.py"
click node_translation "https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/ollama_review.py"
click node_posting "https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/ollama_review.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entrypoint,node_config,node_fetch,node_posting toneBlue
class node_format,node_prompt,node_model_lifecycle,node_response,node_translation toneAmber
class node_review_model,node_translation_model,node_github_api,node_github toneMint
```

## Components

### Action workflow

- [Review entry point](https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/ollama_review.py): `src/ollama_review.py`
- [Prompt configuration](https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/config.py): `src/config.py`
- [Changed-file retrieval](https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/ollama_review.py): `src/ollama_review.py`
- [PR comment posting](https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/ollama_review.py): `src/ollama_review.py`

### Review processing

- [Diff filtering](https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/review.py): `src/review.py`
- [Review prompt](https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/ollama_review.py): `src/ollama_review.py`
- [Model lifecycle](https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/ollama_review.py): `src/ollama_review.py`
- [Review validation](https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/review.py): `src/review.py`
- [Review translation](https://github.com/phurba-sherpa/ollama-pr-review-gh-action/blob/main/src/ollama_review.py): `src/ollama_review.py`

### External services

- **Review model**
- **Translation model**
- **GitHub API**

### Other components

- **Pull request**

## Connections

- Pull request → Review entry point: initiates review (evidence: `README.md`)
- Review entry point → Prompt configuration: loads prompt (evidence: `src/ollama_review.py`)
- Review entry point → Changed-file retrieval: requests review (evidence: `src/ollama_review.py`)
- Changed-file retrieval → GitHub API: fetches PR files (evidence: `src/ollama_review.py`)
- Review entry point → Model lifecycle: prepares model (evidence: `src/ollama_review.py`)
- Model lifecycle → Review model: manages model (evidence: `README.md`)
- Changed-file retrieval → Diff filtering: formats changes (evidence: `src/ollama_review.py`)
- Review entry point → Review prompt: builds request (evidence: `src/ollama_review.py`)
- Review prompt → Review model: requests analysis (evidence: `src/ollama_review.py`)
- Review entry point → Review validation: parses response (evidence: `src/ollama_review.py`)
- Review entry point → Review translation: translates output (evidence: `src/ollama_review.py`)
- Review translation → Translation model: requests translation (evidence: `src/ollama_review.py`)
- Review entry point → PR comment posting: posts findings (evidence: `src/ollama_review.py`)
- PR comment posting → GitHub API: creates PR review (evidence: `README.md`)
