# Repository Referenced-Hostname Registration and Resolution Gate (`kingii98/repository-referenced-hostname-registration-and-resolution-gate`) Actor

Find each hostname in a GitHub repository that does not resolve, is not registered, is near expiry, or is on hold.

- **URL**: https://apify.com/kingii98/repository-referenced-hostname-registration-and-resolution-gate.md
- **Developed by:** [kingii98](https://apify.com/kingii98) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $50.00 / 1,000 scan_starts

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

## Repository Referenced-Hostname Registration and Resolution Gate

This Actor reads files in a public GitHub repository. It finds each hostname that the files reference. It then checks each unique registrable domain. Use it before a release and on a weekly schedule. Domain registration state can change without a commit.

### What it finds

For each domain, the Actor reports one of these problems:

- The domain does not resolve.
- The domain is not registered.
- The domain is near expiry.
- The domain is on hold, or it is pending delete.

### Input

| Field | Default | Meaning |
| --- | --- | --- |
| `repo_url` | `https://github.com/octocat/Hello-World` | Public GitHub repository URL. |
| `ref` | `master` | Branch, tag, or commit. |
| `path_globs` | `README*`, `*.md`, `*.yaml`, `*.yml`, `*.json`, `*.toml` | File patterns to scan. |
| `ignore_domains` | none | Domains to skip. A domain also skips its subdomains. |
| `expiry_warning_days` | `45` | Warn when a domain expires within this number of days. |
| `github_token` | none | Optional. It raises the GitHub rate limit. |

An empty input `{}` is valid. It uses the defaults above.

### Limits

- Maximum 500 files for each run.
- Maximum 1 MB for each file. The Actor skips larger files.
- Maximum 300 unique registrable domains for each run.
- Each request has a 15-second timeout. The Actor follows at most 3 redirects, and only for RDAP, and only to public HTTPS hosts.
- The Actor uses HTTP only. It does not use a browser or a proxy.
- The Actor rejects private and reserved targets. It skips `localhost`, IP addresses, and names that end in `.local`, `.internal`, `.test`, and similar. It skips `example.com`, `example.org`, and `example.net`.

When a limit stops the scan early, the summary shows `truncated: true`, and the gate result is at least `warn`.

### How hostnames are found

The Actor reads two patterns:

1. URLs: `http`, `https`, `oci`, `ftp`, `ws`, `wss`, `git`, and `ssh` schemes.
2. Keys `host`, `hostname`, `domain`, and `server` with a hostname value.

The Actor does not read bare names in free text. This prevents false matches on file names such as `values.yaml`.

The Actor finds the registrable domain with a short built-in list of two-label suffixes (for example `co.uk`). The list is not the full Public Suffix List. A rare suffix can give a wrong domain.

### Output

The dataset has one `domain` row for each unique registrable domain, then one `summary` row.

Domain row fields: `domain`, `hostnames`, `locations` (hostname, file path, line number; at most 50), `dns_name`, `dns_result`, `dns_addresses`, `registration_state`, `rdap_statuses`, `expiry_date`, `days_left`, `flags`, `verdict`, `checked_at`.

- `dns_result`: `resolves`, `nxdomain`, `no_records`, or `error`. The Actor resolves the domain itself when the files name it. Otherwise it resolves the first hostname in alphabetical order.
- `registration_state`: `registered`, `not_registered`, or `unknown`. An RDAP "not found" answer gives `not_registered` only when DNS also returns `nxdomain`. If the name resolves, the state is `unknown`.
- `flags`: `not_registered`, `on_hold`, `pending_delete`, `expired`, `expiring_soon`, `dns_nxdomain`, `dns_no_records`, `dns_error`, `rdap_unavailable`.
- `verdict`: `fail` for `not_registered`, `on_hold`, `pending_delete`, or `expired`. `warn` for any other flag. Else `pass`.

Summary row fields: `gate_result` (`pass`, `warn`, `fail`, or `error`), `message`, `repository`, `ref`, file and domain counts, verdict counts, `truncated`, `events_charged`.

`gate_result` is `error` only when the input is not valid, GitHub gives an error, or the charge limit stops the scan. A failed gate is a normal result. The run ends SUCCEEDED, and the status message gives the verdict.

### Billing (pay-per-event)

| Event | Billing unit | When the Actor charges |
| --- | --- | --- |
| `scan_start` | One repository scan. | One call with count 1, after the input is valid and before the first GitHub request. |
| `domain_check` | One unique registrable domain checked. | One call with count equal to the number of domains to check, after file scanning. |

The Actor charges `domain_check` before it checks the domains. If the run budget allows fewer domains, the Actor checks only that number and sets `truncated: true`. Ignored domains are not charged. A run with no domains has no `domain_check` charge.

### Local run

```
uv run pytest
uv run ruff check .
uv run python -m src
```

Local runs use the Apify storage in `storage/`.

### Data sources

- GitHub API and `raw.githubusercontent.com` for the file tree and file content.
- `dns.google` DNS-over-HTTPS for A and AAAA records.
- `rdap.org` for RDAP registration data. It redirects to the registry RDAP server.

Some country-code TLDs have no RDAP service. For these, `registration_state` is `unknown` and the verdict is `warn`.

# Actor input Schema

## `repo_url` (type: `string`):

Public GitHub repository URL, for example https://github.com/octocat/Hello-World.

## `ref` (type: `string`):

Branch, tag, or commit to scan.

## `path_globs` (type: `array`):

File path patterns to scan. The Actor scans at most 500 files of 1 MB or less.

## `ignore_domains` (type: `array`):

Domains to skip. A domain also skips its subdomains.

## `expiry_warning_days` (type: `integer`):

Warn when a domain expires in this number of days or fewer.

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

Optional token. It raises the GitHub rate limit. It needs no scopes for a public repository.

## Actor input object example

```json
{
  "repo_url": "https://github.com/octocat/Hello-World",
  "ref": "master",
  "path_globs": [
    "README*",
    "*.md",
    "*.yaml",
    "*.yml",
    "*.json",
    "*.toml"
  ],
  "ignore_domains": [],
  "expiry_warning_days": 45
}
```

# Actor output Schema

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

Dataset items for the run.

# 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 = {
    "repo_url": "https://github.com/octocat/Hello-World",
    "ref": "master",
    "path_globs": [
        "README*",
        "*.md",
        "*.yaml",
        "*.yml",
        "*.json",
        "*.toml"
    ],
    "expiry_warning_days": 45
};

// Run the Actor and wait for it to finish
const run = await client.actor("kingii98/repository-referenced-hostname-registration-and-resolution-gate").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 = {
    "repo_url": "https://github.com/octocat/Hello-World",
    "ref": "master",
    "path_globs": [
        "README*",
        "*.md",
        "*.yaml",
        "*.yml",
        "*.json",
        "*.toml",
    ],
    "expiry_warning_days": 45,
}

# Run the Actor and wait for it to finish
run = client.actor("kingii98/repository-referenced-hostname-registration-and-resolution-gate").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 '{
  "repo_url": "https://github.com/octocat/Hello-World",
  "ref": "master",
  "path_globs": [
    "README*",
    "*.md",
    "*.yaml",
    "*.yml",
    "*.json",
    "*.toml"
  ],
  "expiry_warning_days": 45
}' |
apify call kingii98/repository-referenced-hostname-registration-and-resolution-gate --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,kingii98/repository-referenced-hostname-registration-and-resolution-gate"
        }
    }
}
```

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/zK6qXEydhpUOtqUIV/builds/j22Vn286omSgP7CXE/openapi.json
