An open API service indexing awesome lists of open source software.

https://github.com/thumbrise/ghset

ghset init my-repo --from your-repo — declarative GitHub repository settings as YAML
https://github.com/thumbrise/ghset

cli declarative devops github github-api github-settings golang repository-management yaml

Last synced: 29 days ago
JSON representation

ghset init my-repo --from your-repo — declarative GitHub repository settings as YAML

Awesome Lists containing this project

README

          

# ghset

[![CI](https://github.com/thumbrise/ghset/actions/workflows/ci.yml/badge.svg)](https://github.com/thumbrise/ghset/actions/workflows/ci.yml)
[![Go Reference](https://pkg.go.dev/badge/github.com/thumbrise/ghset.svg)](https://pkg.go.dev/github.com/thumbrise/ghset)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](/LICENSE)

Declarative GitHub repository settings. Describe an existing repo into YAML, spin up a new repo from that YAML.

## Why

Every new GitHub repo starts with the same ritual: click through settings, toggle security options, recreate labels, set up branch protection. Multiply that by 10 repos and it's a whole afternoon. **ghset** turns all of that into one command.

## Quick start

Prerequisites: [gh CLI](https://cli.github.com/) installed and authenticated (`gh auth login`).

### Install

**macOS / Linux**
```bash
curl -sfL https://raw.githubusercontent.com/thumbrise/ghset/main/install.sh | sh
```

**Go**
```bash
go install github.com/thumbrise/ghset@latest
```

**Manual** — grab a binary from [Releases](https://github.com/thumbrise/ghset/releases/latest).

### Run

```bash
ghset init my-new-repo --from thumbrise/ghset
```

That's it. The new repo gets everything copied:
- **Settings** — visibility, merge strategies, wiki, issues, projects, discussions
- **Security** — secret scanning, push protection, vulnerability alerts, automated fixes
- **Labels** — create custom, skip existing
- **Rulesets** — branch and tag protection rules

## Commands

```bash
# Snapshot repo settings → YAML
ghset describe thumbrise/ghset > config.yml

# Create new repo from config
ghset init my-new-repo --from config.yml

# Or directly from another repo — no intermediate file
ghset init my-new-repo --from thumbrise/ghset

# Apply config to an existing repo
ghset apply thumbrise/ghset --from config.yml

# Pipe — describe one, create another
ghset describe thumbrise/ghset | ghset init my-new-repo
```

| Command | What it does |
|---------|-------------|
| `describe` | Snapshot repo → YAML to stdout |
| `init` | Create new repo + apply settings |
| `apply` | Apply settings to existing repo |

## How it works

All GitHub API calls go through `gh` CLI as a subprocess. No tokens in the tool, no OAuth — `gh` handles auth entirely.

## Docs & rationale

**[thumbrise.github.io/ghset](https://thumbrise.github.io/ghset/)** — full docs, [why not Terraform / Probot / safe-settings](https://thumbrise.github.io/ghset/why), devlog.

## License

Apache 2.0