# Github Repository Metadata Export (`first_watch/github-repository-metadata-export`) Actor

Teams managing many GitHub repositories lack a simple way to maintain a normalized, auditable inventory and identify repository-level operational or governance changes between snapshots.

- **URL**: https://apify.com/first_watch/github-repository-metadata-export.md
- **Developed by:** [Jordan Nabbe](https://apify.com/first_watch) (community)
- **Categories:** Developer tools, Automation, Business
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 repository rows

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?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## GitHub Repository Metadata Export

GitHub Repository Metadata Export helps platform engineering, security, engineering operations and open-source program office teams keep an auditable inventory of their GitHub repositories and see exactly what changed since the last audit. Paste an existing export (records, JSON, CSV, a plain list, an HTML page or a base64 file) for a fully offline run, or let the Actor collect metadata through GitHub's official REST API. You get one clean, consistently typed row per repository, in the same order as your source, with governance flags and a comparison result against your previous snapshot, ready for spreadsheets, databases, scheduled audits or LLM pipelines.

### What it does

- Normalizes key variants such as `Full Name`, `fullName` and `full_name` into one stable schema.
- Exports repository ID, canonical name and URL, visibility, archive and fork status, default branch, issue setting, SPDX license and timestamps.
- Matches snapshots by stable GitHub ID first, then by case-insensitive `owner/name`.
- Marks each repository row as `added`, `unchanged`, `changed` or `transfer_or_rename` (or `not_compared` when no prior snapshot is given) and lists the changed field names.
- Keeps full field-level before/after values, and repositories that disappeared (`removed`), in the OUTPUT record.
- Adds the governance flags `ARCHIVED`, `MISSING_LICENSE`, `ISSUES_DISABLED`, `STALE_RELEASE`, `DEFAULT_BRANCH_CHANGED` and `TRANSFERRED_OR_RENAMED`.
- Parses records, JSON, CSV (with quoting), newline-delimited text, HTML anchor links and base64-encoded UTF-8 documents.
- Can collect individual repositories and whole organizations from `api.github.com`, with bounded pagination, retries, redirect checks and rate-limit waits. An optional named key-value store keeps ETags between runs.
- Reports invalid rows and inaccessible remote targets per item in OUTPUT and keeps every successful row.

Every dataset row includes a `source_ref` pointing back to its input row, for example `currentSnapshot.records[1]`, `currentSnapshot.text[2]` or `github:acme/payments`.

### How to use it

Click **Start** with the prefilled input to get a real comparison with no network access. Copy-paste example:

```json
{
  "mode": "inline",
  "currentSnapshot": {
    "format": "records",
    "records": [
      { "id": 101, "full_name": "acme/payments", "default_branch": "main", "has_issues": true, "license": { "spdx_id": "MIT" }, "latest_release_at": "2026-09-01T10:00:00Z" },
      { "id": 202, "full_name": "acme/legacy-api", "archived": true, "has_issues": false, "license": null }
    ]
  },
  "priorSnapshot": {
    "format": "records",
    "records": [
      { "id": 101, "full_name": "acme/payments", "default_branch": "master", "has_issues": true, "license": { "spdx_id": "MIT" }, "latest_release_at": "2026-08-01T10:00:00Z" }
    ]
  },
  "staleReleaseDays": 365,
  "asOf": "2026-09-24T12:00:00Z"
}
```

A plain list works too: `{"format": "text", "content": "acme/api\nhttps://github.com/acme/web"}`.

To collect from the GitHub API, set the mode, clear the sample snapshots and list targets:

```json
{ "mode": "github", "repositories": ["apify/apify-sdk-js"], "organizations": ["apify"], "cacheStoreName": "my-github-etags" }
```

The optional `githubToken` is a secret field; it is only sent to `api.github.com` in the Authorization header.

| Format | Fields | Behavior |
|---|---|---|
| `records` | `records` | Reads repository objects directly |
| `json` | `content` | An array, or an object with a `repositories` or `rows` array (a previous OUTPUT record works) |
| `csv` | `content` | Header row plus rows, quoted values supported |
| `text` | `content` | One `owner/name` or GitHub URL per line; blank lines and surrounding spaces are ignored |
| `html` | `content` | Extracts unique repository-root links; scripts are never run |
| `base64_document` | `mediaType`, `data` | Decodes UTF-8 JSON, CSV, text or HTML bytes |

### Output example

The default dataset holds one row per repository, in input order. The `OUTPUT` record holds the summary, the delivered rows, all change entries with before/after values, per-item errors and an `outcome` block (`status`, `itemsReceived`, `itemsSucceeded`, `itemsFailed`, `billableCount`, `limitReached`, `undelivered`). `sample-output.json` is the exact OUTPUT produced from `sample-input.json`.

| full_name | change_type | changed_fields | flags |
|---|---|---|---|
| acme/payments | changed | default_branch, latest_release_at, updated_at | DEFAULT_BRANCH_CHANGED |
| acme/legacy-api | added | | ARCHIVED, MISSING_LICENSE, ISSUES_DISABLED, STALE_RELEASE |

### Pricing

Pay per event. The main charge is per repository row; everything else listed below is free.

| Event | Price (USD) | Charged when |
|---|---|---|
| Actor start (`apify-actor-start`) | $0.005 | Once per run when the Actor starts. |
| Repository row (`apify-default-dataset-item`) | $0.005 | Each repository row is delivered to the default dataset. |

Not charged:

- OUTPUT record
- rejected rows and per-item errors
- removed-repository change entries
- field-level before/after change set
- run summary

Examples (default 512 MB memory, one start event):

- Inventory of 500 repositories: $0.005 start + 1 × $0.005 + 500 × $0.005 = **$2.51**
- Comparison of 20 repositories: $0.005 start + 1 × $0.005 + 20 × $0.005 = **$0.11**

Spending limit: when you set a maximum cost per run, the Actor stops before it would exceed it, keeps every repository row it already delivered and reports `limitReached` in the `OUTPUT` record. It never delivers results beyond the limit.

The Store's Pricing tab shows the prices in force. If this section and the Pricing tab ever differ, the Pricing tab applies.

### Use cases

- Keep an engineering repository catalog up to date across a whole portfolio.
- Compare monthly or quarterly JSON and CSV inventories offline.
- Detect default-branch migrations, transfers, renames, archiving and issue-setting changes.
- Send missing-license and stale-release flags into governance and security review queues.
- Feed normalized metadata into spreadsheets, databases, dashboards or LLM pipelines.

### Limits

- Each inline snapshot holds up to 1,000 repositories and 5 MB of decoded content; the whole input can be up to 15 MB.
- Parsed JSON can be at most 8 levels deep, with 100 keys per object and 1,000 items per array.
- Exceeding a limit fails the run with an explicit error; nothing is truncated silently.
- GitHub mode accepts up to 100 combined targets, returns at most 1,000 unique repositories, makes at most 100 HTTP attempts, follows at most three redirects per request (only to api.github.com), reads at most ten pages per organization and stops collecting after two minutes.
- Standard GitHub repository responses carry no release date, so API rows usually have `latest_release_at: null` and get `STALE_RELEASE`. This is a prompt for review, not proof; supply release timestamps inline for accurate ages.
- Dates are accepted only as real UTC ISO timestamps; ambiguous values such as `03/04/2026` become null rather than being guessed.
- If any row or target fails, the run is marked PARTIAL and removal entries are suppressed, because incomplete data cannot prove a repository disappeared.
- If nothing usable is produced, the run fails with a non-zero exit after writing OUTPUT.
- No contributors, issues, pull requests, READMEs, commits or repository contents are collected. No browser is used.

### FAQ

**Does inline mode need internet access?** No. All inline formats are processed locally.

**In what order are rows returned?** In the order of your current snapshot (or GitHub's API order in GitHub mode). Duplicates keep the first occurrence and are reported in `errors`.

**Can it handle private repositories?** Supply their metadata inline, or provide a token that is allowed to read it. The Actor cannot bypass GitHub visibility rules.

**Can I compare against my last run?** Yes. Paste the JSON of the previous OUTPUT record as `{"format": "json", "content": "..."}` in `priorSnapshot`. Its `rows` array is used as the baseline. A run that stopped at your spending limit gives an incomplete baseline.

**How are transfers and renames detected?** When a repository keeps the same stable ID but its `full_name` changes, it is classified as `transfer_or_rename`. Metadata alone cannot tell a transfer from a rename.

**What happens to invalid rows?** They are reported in OUTPUT `errors` with their source reference and are not charged, as long as other valid rows remain.

**Is the output deterministic?** Yes when you supply `asOf`. IDs are strings or null, booleans are booleans or null, and timestamps are UTC ISO strings.

# Actor input Schema

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

Inline mode processes the snapshots below without any network request. GitHub mode collects the repositories and organizations listed below from api.github.com only.

## `currentSnapshot` (type: `object`):

Required in inline mode and ignored in GitHub mode. An object with a format of records, json, csv, text, html or base64_document. records: {"format":"records","records":\[...]}. json/csv/text/html: {"format":"csv","content":"..."}. base64: {"format":"base64_document","mediaType":"text/csv","data":"..."}. Maximum 1,000 repositories and 5 MB. Output rows keep the order of this snapshot.

## `priorSnapshot` (type: `object`):

Optional comparison baseline in any supported inline format, for example the JSON of a previous run's OUTPUT record (format json). Leave empty for an inventory-only run. Clear the sample baseline when switching to GitHub mode if you do not want a comparison.

## `asOf` (type: `string`):

Optional UTC timestamp such as 2026-09-24T12:00:00Z used for release-age checks and generated_at. Supply it for fully reproducible output; leave empty to use the run time.

## `staleReleaseDays` (type: `integer`):

Repositories with no known release, or whose latest release is older than this many days, receive the STALE_RELEASE flag.

## `includeArchived` (type: `boolean`):

Keep archived repositories in the inventory and comparison results.

## `includeForks` (type: `boolean`):

Keep forked repositories in the inventory and comparison results.

## `repositories` (type: `array`):

owner/name values or https://github.com/owner/name URLs to fetch from the GitHub REST API. At most 100 targets combined with organizations.

## `organizations` (type: `array`):

GitHub organization logins whose repositories are listed through the REST API, up to ten pages of 100 repositories each.

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

Optional customer-supplied token for metadata it is permitted to read or for higher API limits. Used only in the Authorization header to api.github.com; never written to output, cache or logs.

## `cacheStoreName` (type: `string`):

Optional name you choose for a named key-value store (lowercase letters, digits and hyphens). When set, ETags are kept there between runs so unchanged responses are revalidated cheaply. Leave empty to disable caching.

## Actor input object example

```json
{
  "mode": "inline",
  "currentSnapshot": {
    "format": "records",
    "records": [
      {
        "id": 101,
        "full_name": "acme/payments",
        "private": false,
        "archived": false,
        "fork": false,
        "default_branch": "main",
        "has_issues": true,
        "license": {
          "spdx_id": "MIT"
        },
        "latest_release_at": "2026-09-01T10:00:00Z",
        "updated_at": "2026-09-20T12:00:00Z"
      },
      {
        "id": 202,
        "full_name": "acme/legacy-api",
        "private": true,
        "archived": true,
        "fork": false,
        "default_branch": "main",
        "has_issues": false,
        "license": null,
        "latest_release_at": null,
        "updated_at": "2025-01-10T09:00:00Z"
      }
    ]
  },
  "priorSnapshot": {
    "format": "records",
    "records": [
      {
        "id": 101,
        "full_name": "acme/payments",
        "private": false,
        "archived": false,
        "fork": false,
        "default_branch": "master",
        "has_issues": true,
        "license": {
          "spdx_id": "MIT"
        },
        "latest_release_at": "2026-08-01T10:00:00Z",
        "updated_at": "2026-08-15T12:00:00Z"
      }
    ]
  },
  "asOf": "2026-09-24T12:00:00Z",
  "staleReleaseDays": 365,
  "includeArchived": true,
  "includeForks": true
}
```

# Actor output Schema

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

Every result row stored in the default dataset.

## `summary` (type: `string`):

Summary written to the OUTPUT record.

# 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 = {
    "mode": "inline",
    "currentSnapshot": {
        "format": "records",
        "records": [
            {
                "id": 101,
                "full_name": "acme/payments",
                "private": false,
                "archived": false,
                "fork": false,
                "default_branch": "main",
                "has_issues": true,
                "license": {
                    "spdx_id": "MIT"
                },
                "latest_release_at": "2026-09-01T10:00:00Z",
                "updated_at": "2026-09-20T12:00:00Z"
            },
            {
                "id": 202,
                "full_name": "acme/legacy-api",
                "private": true,
                "archived": true,
                "fork": false,
                "default_branch": "main",
                "has_issues": false,
                "license": null,
                "latest_release_at": null,
                "updated_at": "2025-01-10T09:00:00Z"
            }
        ]
    },
    "priorSnapshot": {
        "format": "records",
        "records": [
            {
                "id": 101,
                "full_name": "acme/payments",
                "private": false,
                "archived": false,
                "fork": false,
                "default_branch": "master",
                "has_issues": true,
                "license": {
                    "spdx_id": "MIT"
                },
                "latest_release_at": "2026-08-01T10:00:00Z",
                "updated_at": "2026-08-15T12:00:00Z"
            }
        ]
    },
    "asOf": "2026-09-24T12:00:00Z"
};

// Run the Actor and wait for it to finish
const run = await client.actor("first_watch/github-repository-metadata-export").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 = {
    "mode": "inline",
    "currentSnapshot": {
        "format": "records",
        "records": [
            {
                "id": 101,
                "full_name": "acme/payments",
                "private": False,
                "archived": False,
                "fork": False,
                "default_branch": "main",
                "has_issues": True,
                "license": { "spdx_id": "MIT" },
                "latest_release_at": "2026-09-01T10:00:00Z",
                "updated_at": "2026-09-20T12:00:00Z",
            },
            {
                "id": 202,
                "full_name": "acme/legacy-api",
                "private": True,
                "archived": True,
                "fork": False,
                "default_branch": "main",
                "has_issues": False,
                "license": None,
                "latest_release_at": None,
                "updated_at": "2025-01-10T09:00:00Z",
            },
        ],
    },
    "priorSnapshot": {
        "format": "records",
        "records": [{
                "id": 101,
                "full_name": "acme/payments",
                "private": False,
                "archived": False,
                "fork": False,
                "default_branch": "master",
                "has_issues": True,
                "license": { "spdx_id": "MIT" },
                "latest_release_at": "2026-08-01T10:00:00Z",
                "updated_at": "2026-08-15T12:00:00Z",
            }],
    },
    "asOf": "2026-09-24T12:00:00Z",
}

# Run the Actor and wait for it to finish
run = client.actor("first_watch/github-repository-metadata-export").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 '{
  "mode": "inline",
  "currentSnapshot": {
    "format": "records",
    "records": [
      {
        "id": 101,
        "full_name": "acme/payments",
        "private": false,
        "archived": false,
        "fork": false,
        "default_branch": "main",
        "has_issues": true,
        "license": {
          "spdx_id": "MIT"
        },
        "latest_release_at": "2026-09-01T10:00:00Z",
        "updated_at": "2026-09-20T12:00:00Z"
      },
      {
        "id": 202,
        "full_name": "acme/legacy-api",
        "private": true,
        "archived": true,
        "fork": false,
        "default_branch": "main",
        "has_issues": false,
        "license": null,
        "latest_release_at": null,
        "updated_at": "2025-01-10T09:00:00Z"
      }
    ]
  },
  "priorSnapshot": {
    "format": "records",
    "records": [
      {
        "id": 101,
        "full_name": "acme/payments",
        "private": false,
        "archived": false,
        "fork": false,
        "default_branch": "master",
        "has_issues": true,
        "license": {
          "spdx_id": "MIT"
        },
        "latest_release_at": "2026-08-01T10:00:00Z",
        "updated_at": "2026-08-15T12:00:00Z"
      }
    ]
  },
  "asOf": "2026-09-24T12:00:00Z"
}' |
apify call first_watch/github-repository-metadata-export --silent --output-dataset

```

## MCP server setup

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

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/ssFkcJ0FHbSxiyJlm/builds/GIc2HqmqY0z7La4q9/openapi.json
