https://github.com/maxbeizer/gh-extension-template
Template repo for Go-based gh CLI extensions
https://github.com/maxbeizer/gh-extension-template
gh-extension
Last synced: 2 months ago
JSON representation
Template repo for Go-based gh CLI extensions
- Host: GitHub
- URL: https://github.com/maxbeizer/gh-extension-template
- Owner: maxbeizer
- License: mit
- Created: 2026-02-22T21:53:29.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-03-21T11:21:38.000Z (3 months ago)
- Last Synced: 2026-03-22T02:33:36.163Z (3 months ago)
- Topics: gh-extension
- Language: Makefile
- Size: 13.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# gh-extension-template
A template for building [GitHub CLI](https://cli.github.com/) extensions in Go.
## Using this template
1. Create a new repo from this template:
```bash
gh repo create my-org/gh-my-extension --template maxbeizer/gh-extension-template --private --clone
cd gh-my-extension
```
2. Update these files:
- **`go.mod`** — change the module path to your repo
- **`Makefile`** — change `EXTENSION_NAME` to your extension name (without `gh-` prefix)
- **`.goreleaser.yml`** — change `project_name` and `binary` to `gh-`
- **`main.go`** — change `Use` field and implement your commands
3. Verify everything works:
```bash
make ci
make install-local
gh my-extension
```
## Development
```bash
make help # see all targets
make build # build binary
make test # run tests
make ci # build + vet + test-race
make install-local # install extension from checkout
make relink-local # reinstall after changes
```
## Releasing
Tag a version to trigger a release build:
```bash
git tag v0.1.0
git push origin v0.1.0
```
The GitHub Actions workflow uses [goreleaser](https://goreleaser.com/) to build binaries for darwin/linux (amd64/arm64) and create a GitHub release. Once released, users install with:
```bash
gh extension install my-org/gh-my-extension
```
## What's included
| File | Purpose |
|------|---------|
| `Makefile` | Build, test, lint, install targets |
| `.goreleaser.yml` | Cross-platform binary releases |
| `.github/workflows/release.yml` | Automated releases on tag push |
| `.github/workflows/ci.yml` | CI on push/PR to main |
| `main.go` | Minimal starter with cobra + signal handling |
| `.gitignore` | Go/editor/OS ignores |