Skip to contents

Retrieve repository metadata for documentation, inventory tracking, or automated workflows that need to enumerate organization repositories. Use this to generate up-to-date repository lists for README files, documentation sites, or CI/CD pipelines.

Returns a data.table with markdown-ready links and topics for easy inclusion in documentation.

Usage

get_repo_index(org = "artalytics", token = Sys.getenv("GITHUB_PAT"))

Arguments

org

Character. GitHub organization name to query (e.g., "artalytics", "tidyverse", "rstudio"). Defaults to "artalytics". Organization must exist and be accessible with the provided token. For private organizations, token must have appropriate access.

token

Character. GitHub Personal Access Token (format: ghp_xxxxxxxxxxxx...). Defaults to GITHUB_PAT environment variable. Token must have repo scope for private repositories, or public_repo scope for public-only access. Generate at https://github.com/settings/tokens. If token is invalid or expired, the API call will fail with an authentication error.

Value

A data.table with the following columns:

repo_name

Character. The name of the repository.

visibility

Character. The visibility of the repository ("public" or "private").

description

Character. The repository description, or NA if none.

repo_url

Character. The URL to the repository on GitHub.

repo_md

Character. A markdown-formatted link to the repository.

topics

List. Repository topics as a character vector (empty when none are set).

See also

Examples

if (FALSE) { # \dontrun{
# List all repos for the default organization
repos <- get_repo_index()

# List repos for a different organization
repos <- get_repo_index(org = "tidyverse")

# Use a specific token
repos <- get_repo_index(token = "ghp_xxxxxxxxxxxx")
} # }