# GitHub Repo Scraper - Code & Docs to LLM-Ready Text (`get_anything/github-repo-scraper`) Actor

Chat with a repo: turn any GitHub repository into LLM-ready text - README, file tree and source files as clean text with token counts, plus repo metadata and optional issues. Feed a codebase to ChatGPT/Claude or a RAG pipeline. Official GitHub API, no token required. Export JSON, CSV or Markdown.

- **URL**: https://apify.com/get\_anything/github-repo-scraper.md
- **Developed by:** [Get Anything](https://apify.com/get_anything) (community)
- **Categories:** Developer tools, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.10 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — 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 Repo Scraper — Code & Docs to LLM-Ready Text

**Chat with a repo.** Turn any GitHub repository into clean, **LLM-ready text**: the README, the file tree, and the contents of selected source/doc files — each with a token count — plus repo metadata and (optionally) recent issues. Built for feeding a codebase into **ChatGPT / Claude** or a **RAG** pipeline.

### Why this one

AI coding assistants and RAG-over-code are one of the biggest LLM use cases. This Actor gives you the whole repo as structured text in one run — no cloning, no git, no parsing HTML. It uses **GitHub's official REST API** plus `raw.githubusercontent.com`, so it's fast and reliable. Works **without a token** (60 req/h); add one for 5,000 req/h.

### What it does

- Scrape **multiple repos** by `owner/repo` or URL.
- **README** + **file tree** + **file contents** (filtered by glob patterns).
- Sensible **include/exclude** defaults (code + docs in; `node_modules`, lockfiles, binaries out).
- Caps for **max files**, **file size**, and **chars per file** to control token cost.
- Optional **issues** as text.
- Export to **JSON, CSV, or Markdown**, or pull via the Apify API.

### Input

| Field | Description |
|-------|-------------|
| `repos` | Repositories as `owner/repo` or GitHub URLs. |
| `includeReadme` / `includeFileTree` / `includeFileContents` | What to return. |
| `includePatterns` / `excludePatterns` | Glob filters (defaults provided). |
| `maxFiles` / `maxFileSizeKB` / `maxCharsPerFile` | Token-budget caps. |
| `includeIssues` / `maxIssues` | Optionally pull issues. |
| `githubToken` | Optional PAT for a higher rate limit. |

#### Example

```json
{
  "repos": ["apify/apify-sdk-python"],
  "includeReadme": true,
  "includeFileContents": true,
  "includePatterns": ["*.py", "*.md"],
  "maxFiles": 50,
  "maxFileSizeKB": 100
}
```

### Output

One `repo` record (metadata + README + tree), then one `file` record per selected file:

```json
{ "resultType": "file", "repo": "apify/apify-sdk-python", "path": "src/apify/actor.py",
  "content": "from __future__ ...", "tokensApprox": 1820,
  "url": "https://github.com/apify/apify-sdk-python/blob/master/src/apify/actor.py" }
```

### Use cases

- **RAG over a codebase** — chunk `file.content` into a vector DB, ask questions about the repo.
- **LLM code review / onboarding** — paste README + key files into ChatGPT/Claude.
- **Docs generation** — summarise a repo from its README and source.
- **Dependency / license audits** — pull metadata across many repos.

### FAQ

**Do I need a token?** No — but a token raises the limit to 5,000 req/h for large runs.

**How are binary files handled?** Skipped (size cap + a binary guard); only text is returned.

# Actor input Schema

## `repos` (type: `array`):

GitHub repositories as 'owner/repo' or full URLs, e.g. 'apify/apify-sdk-python'.

## `includeReadme` (type: `boolean`):

Include the repository README in the repo record.

## `includeFileTree` (type: `boolean`):

Include the full list of file paths in the repo record.

## `includeFileContents` (type: `boolean`):

Emit one record per selected file with its text content.

## `includePatterns` (type: `array`):

Glob patterns of files to include (e.g. '*.py', '*.md'). Leave empty for a sensible code+docs default.

## `excludePatterns` (type: `array`):

Glob patterns to skip (e.g. '*/node\_modules/*', '\*.lock'). Leave empty for a sensible default.

## `maxFiles` (type: `integer`):

Cap on the number of file-content records per repo.

## `maxFileSizeKB` (type: `integer`):

Skip files larger than this (keeps token cost sane).

## `maxCharsPerFile` (type: `integer`):

Truncate each file's content (0 = no limit).

## `includeIssues` (type: `boolean`):

Also pull recent issues as text records.

## `maxIssues` (type: `integer`):

Cap on issues per repo when included.

## `githubToken` (type: `string`):

A GitHub personal access token raises the rate limit from 60 to 5,000 requests/hour. Not required for small runs.

## Actor input object example

```json
{
  "repos": [
    "apify/apify-sdk-python"
  ],
  "includeReadme": true,
  "includeFileTree": true,
  "includeFileContents": true,
  "includePatterns": [],
  "excludePatterns": [],
  "maxFiles": 50,
  "maxFileSizeKB": 100,
  "maxCharsPerFile": 0,
  "includeIssues": false,
  "maxIssues": 20
}
```

# Actor output Schema

## `results` (type: `string`):

Structured results in the default dataset - one item per repo, file or issue.

# 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 = {
    "repos": [
        "apify/apify-sdk-python"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("get_anything/github-repo-scraper").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 = { "repos": ["apify/apify-sdk-python"] }

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

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

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

```

## CLI example

```bash
echo '{
  "repos": [
    "apify/apify-sdk-python"
  ]
}' |
apify call get_anything/github-repo-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,get_anything/github-repo-scraper"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/WxmBi6963AZha8gK8/builds/MOtqt7pccrCoPx2AD/openapi.json
