# Github Pull Request Scraper Api (`fresh_cliff/github-pull-request-scraper-api`) Actor

Extract GitHub pull requests with commits, reviews, comments & merge data. Monitor PR velocity, track code review metrics, analyze team productivity. Export to JSON/CSV for DevOps analytics, CI/CD automation & reporting. No API token needed. Fast Playwright scraper for developers & managers.

- **URL**: https://apify.com/fresh\_cliff/github-pull-request-scraper-api.md
- **Developed by:** [Brennan Crawford](https://apify.com/fresh_cliff) (community)
- **Categories:** Developer tools, Automation, Integrations
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$4.99/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## GitHub Pull Request Scraper & API

Extract pull requests, reviews, comments, commits, and merge status from any GitHub repository. Monitor PR activity, analyze code review metrics, and track contribution statistics with this fast, production-ready Playwright scraper.

### 🚀 Key Features

- **Comprehensive PR Data**: Extract titles, states, authors, timestamps, labels, and more
- **Detailed Statistics**: Get commits count, changed files, additions/deletions, and review metrics
- **Flexible Filtering**: Filter by PR state (open, closed, merged) and limit results
- **Fast & Reliable**: Built with Playwright for stable, production-ready scraping
- **Export Ready**: Output to JSON or CSV for analytics, dashboards, and integrations
- **No Authentication Required**: Scrape public repositories without GitHub API tokens

### 📊 Use Cases

- **DevOps Analytics**: Track PR velocity, review times, and team productivity
- **Code Review Monitoring**: Monitor PR activity and review patterns
- **Open Source Insights**: Analyze contribution patterns in OSS projects
- **Team Metrics**: Generate reports on code review efficiency
- **Competitive Intelligence**: Track development activity in competitor repositories
- **Research & Analysis**: Study PR trends and collaboration patterns

### 🎯 What Gets Scraped

Each pull request includes:

- **Basic Info**: Title, number, state (Open/Closed/Merged), URL
- **Author Details**: Username and profile URL
- **Timestamps**: Created, updated, merged, and closed dates
- **Statistics**: Comments count, commits count, changed files
- **Code Changes**: Lines added and deleted
- **Metadata**: Labels, reviewers, base/head branches
- **Repository**: Owner and repo name

### 📝 Input Configuration

```json
{
  "repositoryUrl": "https://github.com/microsoft/vscode",
  "state": "all",
  "maxPRs": 50,
  "includeDetails": true
}
````

#### Input Parameters

- **repositoryUrl** (required): Full GitHub repository URL
- **state** (optional): Filter PRs by state - `all`, `open`, or `closed` (default: `all`)
- **maxPRs** (optional): Maximum number of PRs to scrape, 1-500 (default: `50`)
- **includeDetails** (optional): Include detailed stats like commits and file changes (default: `true`)

### 📤 Output Format

```json
{
  "title": "Add support for TypeScript 5.0",
  "number": 12345,
  "state": "Merged",
  "author": "username",
  "author_url": "https://github.com/username",
  "created_at": "2024-01-15T10:30:00Z",
  "merged_at": "2024-01-20T14:45:00Z",
  "comments_count": 15,
  "commits_count": 8,
  "changed_files": 23,
  "additions": 456,
  "deletions": 123,
  "labels": ["enhancement", "typescript"],
  "reviewers": ["reviewer1", "reviewer2"],
  "url": "https://github.com/microsoft/vscode/pull/12345",
  "repository": "microsoft/vscode",
  "base_branch": "main",
  "head_branch": "feature/ts5-support"
}
```

### 🔧 How to Use

1. **Create a free Apify account** at [apify.com](https://apify.com)
2. **Search for "GitHub Pull Request Scraper"** in Apify Store
3. **Configure input**: Add repository URL and optional filters
4. **Click Start** and wait for results
5. **Export data**: Download as JSON, CSV, or integrate via API

### ⚡ Performance

- Scrapes **50 PRs in ~2-3 minutes**
- Handles repositories with thousands of PRs
- Optimized for speed with Playwright
- Automatic retry on network errors

### 🛠️ Technical Details

- **Runtime**: Python 3.11 with Playwright
- **Browser**: Chromium (headless)
- **Rate Limiting**: Respectful scraping with delays
- **Error Handling**: Robust error recovery and logging

### 💡 Pro Tips

- Set `includeDetails: false` for faster scraping if you don't need commit/file stats
- Use `state: "open"` to monitor active PRs only
- Increase `maxPRs` for comprehensive historical analysis
- Schedule regular runs to track PR trends over time

### 📊 Integration Examples

#### Slack Notifications

Monitor new PRs and send alerts to your team channel

#### Analytics Dashboards

Feed PR data into Tableau, PowerBI, or custom dashboards

#### CI/CD Pipelines

Trigger workflows based on PR activity

#### Research Projects

Analyze OSS development patterns and collaboration

### 🔒 Privacy & Compliance

- Only scrapes publicly available data
- No authentication or API tokens required
- Respects GitHub's robots.txt
- Compliant with GitHub's Terms of Service for public data

### 🆘 Support

Need help? Have questions?

- [Apify Documentation](https://docs.apify.com)
- [GitHub Issues](https://github.com/apify/apify-sdk-python/issues)
- [Apify Discord](https://discord.apify.com)

### 📜 License

This actor is available under the Apache 2.0 license.

***

**Built with ❤️ using [Apify](https://apify.com) and [Playwright](https://playwright.dev)**

**Keywords**: GitHub scraper, pull request scraper, PR analytics, code review metrics, GitHub API alternative, DevOps tools, repository analytics, open source insights, contribution tracking, GitHub data extraction

# Actor input Schema

## `repositoryUrl` (type: `string`):

GitHub repository URL (e.g., https://github.com/owner/repo)

## `state` (type: `string`):

Filter PRs by state

## `maxPRs` (type: `integer`):

Maximum number of pull requests to scrape (default: 50)

## `includeDetails` (type: `boolean`):

Include detailed stats like commits, changed files, additions/deletions (slower but more complete)

## Actor input object example

```json
{
  "repositoryUrl": "https://github.com/microsoft/vscode",
  "state": "all",
  "maxPRs": 50,
  "includeDetails": true
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("fresh_cliff/github-pull-request-scraper-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("fresh_cliff/github-pull-request-scraper-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call fresh_cliff/github-pull-request-scraper-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=fresh_cliff/github-pull-request-scraper-api",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Github Pull Request Scraper Api",
        "description": "Extract GitHub pull requests with commits, reviews, comments & merge data. Monitor PR velocity, track code review metrics, analyze team productivity. Export to JSON/CSV for DevOps analytics, CI/CD automation & reporting. No API token needed. Fast Playwright scraper for developers & managers.",
        "version": "1.0",
        "x-build-id": "1fUi9bC1J9Q5keakv"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/fresh_cliff~github-pull-request-scraper-api/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-fresh_cliff-github-pull-request-scraper-api",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/fresh_cliff~github-pull-request-scraper-api/runs": {
            "post": {
                "operationId": "runs-sync-fresh_cliff-github-pull-request-scraper-api",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/fresh_cliff~github-pull-request-scraper-api/run-sync": {
            "post": {
                "operationId": "run-sync-fresh_cliff-github-pull-request-scraper-api",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "repositoryUrl"
                ],
                "properties": {
                    "repositoryUrl": {
                        "title": "Repository URL",
                        "type": "string",
                        "description": "GitHub repository URL (e.g., https://github.com/owner/repo)"
                    },
                    "state": {
                        "title": "PR State Filter",
                        "enum": [
                            "all",
                            "open",
                            "closed"
                        ],
                        "type": "string",
                        "description": "Filter PRs by state",
                        "default": "all"
                    },
                    "maxPRs": {
                        "title": "Maximum PRs to Scrape",
                        "minimum": 1,
                        "maximum": 500,
                        "type": "integer",
                        "description": "Maximum number of pull requests to scrape (default: 50)",
                        "default": 50
                    },
                    "includeDetails": {
                        "title": "Include Detailed Stats",
                        "type": "boolean",
                        "description": "Include detailed stats like commits, changed files, additions/deletions (slower but more complete)",
                        "default": true
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
