Development
Prerequisites
Section titled “Prerequisites”- Go matching go.mod
- The GitHub CLI (
gh) and Git make- Node.js 24 only if you work on the documentation site
Build and run
Section titled “Build and run”git clone https://github.com/AmadeusITGroup/gh-app-auth.gitcd gh-app-authgo mod downloadgo build -o gh-app-auth .gh extension install .Everyday commands
Section titled “Everyday commands”| Command | Purpose |
|---|---|
make test |
Run the test suite; run it after changing Go files |
go test -race ./... |
Run with the race detector |
go test -v ./pkg/auth/... |
Run one package verbosely |
make fmt |
Format code; run it before committing |
make lint |
The full golangci-lint configuration, including lll line length; run it as well as make quality |
make quality |
Lint, coverage threshold and security scan |
make ci |
Simulate the CI pipeline locally |
make security-scan |
Run the security scanners |
Project structure
Section titled “Project structure”cmd/ Cobra commands, including the Git credential helperpkg/auth GitHub App authentication and token exchangepkg/cache In-memory installation token cachepkg/config Configuration loading and validationpkg/jwt JWT creationpkg/matcher URL pattern matching for GitHub Appspkg/secrets Keyring and file secret storagepkg/scope Installation scope metadatapkg/logger Diagnostic loggingtest/ Integration and end-to-end testsdocs/ Documentation (the source of the site)website/ The documentation site shellConventions
Section titled “Conventions”- Wrap errors with context:
fmt.Errorf("failed to load config from %s: %w", path, err). - Use
fmt.Printlnfor static strings andfmt.Printfonly when formatting values. - Never log tokens in clear text; log redacted secret metadata (
logger.HashTokenis a legacy name for redaction, not a digest). Never hardcode credentials or commit test keys. - Validate key file permissions, and prefer the OS keyring.
- Use
t.TempDir()andt.Setenv()for test isolation. - Follow the commit message format in CONTRIBUTING.md.
Security-sensitive areas
Section titled “Security-sensitive areas”Take extra care, and ask the maintainers first, when you change pkg/secrets, pkg/auth, pkg/jwt,
the Git credential helper in cmd/git-credential.go, the configuration file format or the CI
workflows. See the security model for current limits and
architecture decisions for the recorded rationale.
Changes that need more than code
Section titled “Changes that need more than code”A new command needs a test file, registration in cmd/root.go and a regenerated CLI reference page.
Run npm run reference:generate in website/ after changing any command or flag, so the generated
reference matches. See the documentation guide.
Architecture decisions
Section titled “Architecture decisions”Significant technical decisions are recorded as numbered, immutable Architecture Decision Records (ADRs). The ADR index holds the template, naming rules, status lifecycle and the list of records with their actual statuses. Write an ADR for breaking changes, new features that introduce a concept or trust boundary, security decisions, technology choices, significant refactoring and rejected alternatives worth recording. Bug fixes, test additions, documentation-only changes and formatting do not need one. Never rewrite an accepted ADR; supersede it with a new one.