Skip to content

Repo Management

Declarative, YAML-driven GitHub repository configuration. Describe how a repository should be configured in a YAML file; repo-management reads the live state, shows you the diff, and reconciles it through the GitHub API.

It is declarative and idempotent: re-running when nothing has changed does nothing. A section you don't mention is left unmanaged; a section you do declare is the complete desired set, so anything on the repo not listed in it is removed — except the access-granting sections (collaborators, teams, deploy_keys), which are add-only by default.

Install

Install instructions go here — replace with this project's real install steps.

Quick start

export GITHUB_TOKEN=ghp_...

cat > repos.yaml <<'EOF'
repos:
  - your-user/your-repo
settings:
  has_wiki: false
  delete_branch_on_merge: true
labels:
  - {name: bug,         color: d73a4a}
  - {name: enhancement, color: a2eeef}
EOF

repo-management validate -c repos.yaml   # check the YAML (no network)
repo-management plan     -c repos.yaml   # show the diff (read-only)
repo-management apply    -c repos.yaml   # reconcile (prompts before writing)

plan prints one line per change: + create, ~ update, - delete. Secret values are always redacted. repo-management list-repos prints the managed fleet across a config directory with no network access — see the CLI reference for every command and flag.

Most declared sections are authoritative

A declared labels: section deletes labels not in the list. Start with plan and read the diff before your first apply.

The exceptions are the three access-granting sections — collaborators, teams, deploy_keys — which are add-only by default: they manage the principals they name and never revoke anyone else's access. Set the matching *_mode to authoritative to make them the complete set. See Section authority.

Reference

  • CLI

    validate, plan, apply, list-repos — flags, output formats, and errors.

  • Config files

    Every section and field, authority semantics, and composing layers with extends.

  • Rulesets

    Branch, tag, and push rulesets: rule types, conditions, and bypass actors.

What it manages

Each section below is independent — declare only the ones you want managed — and most declared sections are authoritative (see the warning above). Full field-by-field detail for every section lives in the config reference.

  • settings

    Description, homepage, topics, visibility, feature toggles, merge options, default branch, template/archived flags.

  • actions

    Actions enablement/policy (including selected-actions patterns and SHA-pinning), default workflow permissions, workflow-approval permission, fork-PR workflow settings, external workflow access, and artifact/log retention.

  • security

    Secret scanning + push protection, Dependabot vulnerability alerts, automated security fixes, private vulnerability reporting.

  • rulesets

    Repository rulesets (branch, tag, and push) with their rules, bypass actors, and ref-name conditions.

  • labels

    Create/update/delete labels to match the listed set exactly.

  • collaborators

    Add/re-permission direct collaborators; leave unlisted ones alone (add-only by default).

  • webhooks

    Create/update/delete webhooks, matched by URL.

  • deploy_keys

    Create deploy keys, matched by key content; leave unlisted ones alone (add-only by default).

  • autolinks

    Create/delete autolink references, matched by key prefix; delete those not listed.

  • pages

    GitHub Pages build type, source, custom domain, HTTPS enforcement; can also disable Pages.

  • secrets

    Actions secrets (write-only); delete those not listed.

  • variables

    Actions repository variables; delete those not listed.

  • environments

    Deployment environments — wait timer, reviewers, self-review prevention, branch policy — plus environment-scoped secrets/variables.

Fleet automation

Beyond the CLI, the nivintw/repo-management repository — the tool's home — is itself a working deployment: a control plane that manages its author's repositories with scheduled GitHub Actions, reconciling them to config/*.yml on every push and running a central Renovate instance scoped to exactly that fleet via repo-management list-repos --format names. It doubles as a reference for running the tool this way.

Development

Clone the repository, then:

uv sync                      # create the venv + install everything
uv run pytest                # tests + coverage (gate: 90%; currently 100%)
uvx prek@0.5.11 run --all-files     # the full quality gate (ruff, format, REUSE, typos, …)