# GitHub Repos Scraper - trending repos, stars, topics, search (`retrainmap/github-repos`) Actor

Repositories from GitHub's public search API, one row each: full name, owner, description, language, stars, forks, license, topics, created/updated/pushed dates and URL. Trending mode lists new repos by stars; search mode takes GitHub search syntax. For dev-tool teams, VC scouts and researchers.

- **URL**: https://apify.com/retrainmap/github-repos.md
- **Developed by:** [RetrainMap Team](https://apify.com/retrainmap) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 records

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 repositories — search + trending-style ranking (public API)

One row per repository from GitHub's public REST search API
(https://api.github.com/search/repositories): full name, description, language, stars, forks,
watchers, open issues, license, topics, archived/fork flags, created/updated/pushed dates,
homepage, GitHub URL, owner and owner type, plus the row's rank in the API's order. Two modes:

- **trending** — repositories created in the last *N* days with at least *M* stars, sorted by
  stars. GitHub has no trending API; this is the standard emulation and every row says so in
  `ranking`.
- **search** — your own query in GitHub search syntax (`topic:llm`, `org:apache`, `in:name cli`,
  plain words), with optional language, created-after and minimum-stars filters, sorted by stars,
  forks, recently updated or best match.

**The default input (trending, last 7 days, ≥ 10 stars, 100 rows — one request) succeeds
within 5 minutes and returns rows** — Apify auto-tests it daily.

### Data source and status

| | |
|---|---|
| Publisher | GitHub, Inc. — REST API, search endpoint (documentation: https://docs.github.com/en/rest/search/search#search-repositories) |
| Access | Public, no key needed. **Rate limit: 10 search requests per minute unauthenticated, 30 with a token** (each request = up to 100 repositories). The Actor spaces requests at 6.5 s (2.5 s with a token), reads the `x-ratelimit-*` headers, and on a 403/429 with the limit exhausted waits for the reset (≤ 90 s) and retries |
| Optional token | `github_token` (secret input): a personal access token with **no scopes** is enough. Sent only to `api.github.com` as `Authorization: Bearer`; never stored, logged or written to the dataset |
| Terms | GitHub Terms of Service and API terms (https://docs.github.com/en/site-policy/github-terms/github-terms-of-service): repository metadata is public; do not use the data to spam or to build a competing service that scrapes users' personal information. Owner login and type are included because they are part of the repository's public name; no e-mail or profile data is read |
| Refresh cadence | Live on every run; star counts are the API's values at fetch time (`fetched_at`) |
| Known caveats | GitHub search returns **at most 1,000 results per query** (10 pages of 100) — narrow the query for more; `incomplete_results: true` in `RUN_SUMMARY` means the search timed out server-side and the list may be short; `language` is GitHub's detected primary language and can be null; `license` is the SPDX id (`MIT`, `Apache-2.0`) or the license name when SPDX is `NOASSERTION`; a 1,000-row unauthenticated run takes ~65 s because of the rate limit |

Honesty note: rows are the API's own fields renamed (`stargazers_count` → `stars`, `fork` →
`is_fork`, `size` → `size_kb`); nothing is inferred or scored by this Actor. A body without
`total_count`/`items`, or an item without `full_name`/`html_url`, stops the run with an error
rather than guess.

Identification: requests carry a product-token User-Agent, the `X-GitHub-Api-Version` header
and the operator's contact address in the standard `From:` header.

### Input

| Field | Type | Meaning |
|---|---|---|
| `mode` | `trending` / `search` | Default `trending` |
| `query` | string | GitHub search syntax; required in search mode (or a filter), optional in trending |
| `language` | string | Optional, e.g. `Python`, `TypeScript`, `Jupyter Notebook` |
| `sort` | `stars` / `forks` / `updated` / `best-match` | Search mode only (trending is always by stars) |
| `created_after` | `YYYY-MM-DD` | Search mode: creation-date lower bound |
| `trending_days` | integer | Trending window, default 7 |
| `min_stars` | integer | Default 10 |
| `max_records` | integer | Default 100, at most 1,000 |
| `include_forks`, `include_archived` | boolean | Default off (`fork:false archived:false` are added) |
| `github_token` | secret string | Optional; raises the rate limit |
| `contact_email` | string | Sent in the `From:` header |

Example — Python LLM repositories created this year, most recently updated first:

```json
{ "mode": "search", "query": "topic:llm", "language": "Python", "sort": "updated", "created_after": "2026-01-01", "min_stars": 50, "max_records": 150 }
```

### Output (dataset row)

`rank`, `ranking`, `full_name`, `name`, `owner`, `owner_type`, `description`, `language`,
`stars`, `forks`, `watchers`, `open_issues`, `license`, `license_name`, `topics`, `archived`,
`is_fork`, `default_branch`, `size_kb`, `created_at`, `updated_at`, `pushed_at`, `homepage`,
`html_url`, `api_url`, `fetched_at`, `source`.

A run summary (the exact query sent, GitHub's `total_count`, `incomplete_results`, pages,
requests, rate-limit waits and remaining quota, whether the pay-per-event budget stopped the
run) is stored as `RUN_SUMMARY` in the run's key-value store.

### Pricing (pay per event)

| Event | Price |
|---|---|
| `run-start` — once per run | $0.10 |
| `record` — per row written | $0.005 |

The default pull (100 rows) costs $0.60; the 1,000-row maximum costs $5.10. Rows stop when
your run's maximum charge is reached; the run summary says so.

### Operator

Steelyard Ventures LLC (RetrainMap) — info@steelyardclinical.com. Not affiliated with GitHub.
The Actor writes only to its own dataset and key-value store; it stores no credentials (the
optional token lives in the run input, marked secret) and sends nothing else.

# Actor input Schema

## `mode` (type: `string`):

trending = created in the last `trending_days` days with >= `min_stars` stars, sorted by stars. search = your own `query` in GitHub search syntax with the `sort` you choose.

## `query` (type: `string`):

GitHub repository search syntax, e.g. `machine learning`, `topic:llm`, `org:apache`, `in:name cli`. Required in search mode (or give a language / created\_after / min\_stars filter); optional extra terms in trending mode.

## `language` (type: `string`):

Optional GitHub language name, e.g. Python, TypeScript, Rust, Go, Jupyter Notebook.

## `sort` (type: `string`):

Order of the results in search mode; trending mode always sorts by stars.

## `created_after` (type: `string`):

Optional lower bound on the repository creation date (search mode).

## `trending_days` (type: `integer`):

Trending mode: repositories created within the last N days (1-365).

## `min_stars` (type: `integer`):

Keep repositories with at least this many stars (trending mode default 10; 0 = no floor in search mode).

## `max_records` (type: `integer`):

Stop after this many repositories. GitHub search returns at most 1,000 results per query; each 100 costs one request (10 per minute without a token).

## `include_forks` (type: `boolean`):

Off = `fork:false` is added to the query.

## `include_archived` (type: `boolean`):

Off = `archived:false` is added to the query.

## `github_token` (type: `string`):

A personal access token with no scopes raises the search limit from 10 to 30 requests per minute. Sent only to api.github.com as a Bearer header; never stored or logged.

## `contact_email` (type: `string`):

Sent in the standard From: request header so the data owner can reach the operator (RFC 9110 s10.1.2).

## Actor input object example

```json
{
  "mode": "trending",
  "sort": "stars",
  "trending_days": 7,
  "min_stars": 10,
  "max_records": 100,
  "include_forks": false,
  "include_archived": false,
  "contact_email": "info@steelyardclinical.com"
}
```

# Actor output Schema

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

One row per repository: full name, description, language, stars, forks, open issues, license, topics, dates, homepage, URL, owner type, rank.

## `results_csv` (type: `string`):

The same rows as a CSV file.

# 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("retrainmap/github-repos").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("retrainmap/github-repos").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 '{}' |
apify call retrainmap/github-repos --silent --output-dataset

```

## MCP server setup

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

```

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/lBpObrKI9SADdURu3/builds/bdu4cPv7cTaxvLhgR/openapi.json
