Pierre Roy

Ayfrighlog

Generate release notes based on GitHub Commits

TypeScript 0 stars 0 forks updated 04/09/2026

ghlog

Bun License: MIT

Changelog generator for GitHub repositories that automatically categorizes commits following the Conventional Commits specification.

Features

  • Automatic commit categorization (feat, fix, docs, etc.)
  • Breaking change detection (feat!: or a BREAKING CHANGE: footer)
  • Sectioned markdown output with linked commit SHAs
  • Configurable categories and contributor filtering
  • Advanced commit filtering by type, scope, patterns, and authors
  • Flat output mode without categories
  • CLI and programmatic API
  • Flexible ref ranges, any commit, tag, or branch
  • GitHub API authentication support

Installation

git clone https://github.com/Ayfri/ghlog
cd ghlog
bun install
bun link          # makes `ghlog` available globally

Or run directly without installing:

bun run /path/to/ghlog.ts owner/repo

Global installation (standalone binary)

Compiles a standalone executable and drops it into ~/.local/bin (make sure that's on your PATH).

git clone https://github.com/Ayfri/ghlog
cd ghlog
bun install
# Windows (PowerShell)
./install.ps1
# Linux/macOS
mkdir -p ~/.local/bin
bun build ./ghlog.ts --compile --minify --bytecode --outfile ~/.local/bin/ghlog

Quick start

# Changelog for the latest release
ghlog owner/repo

# Between two tags
ghlog owner/repo v1.0.0 v2.0.0

# Custom output file and version tag
ghlog owner/repo -v v2.1.0 -o HISTORY.md

# Append to an existing file
ghlog owner/repo -a

# Skip certain commit types and authors
ghlog owner/repo --exclude-types "chore,test,style,docs" --skip-authors "@dependabot[bot]"

# Flat list without categories
ghlog owner/repo --no-categories --no-contributors

# Custom title
ghlog owner/repo --title "My Custom Changelog Title"

CLI reference

ghlog <owner/repo> [base_ref] [head_ref] [...options]

Arguments
  base_ref  base git ref  (default: latest tag or initial commit)
  head_ref  head git ref  (default: latest commit)

Options
  -a, --append                        append to existing file
      --auth <token>                  GitHub access token
      --exclude-patterns <patterns>   exclude commits matching regex (comma-separated)
      --exclude-scopes <scopes>       exclude commits with these scopes (comma-separated)
      --exclude-types <types>         exclude commits with these types (comma-separated)
  -h, --help                          show help
      --include-non-conventional      include non-conventional commits
      --include-patterns <patterns>   include commits matching regex (comma-separated)
      --include-scopes <scopes>       include only commits with these scopes (comma-separated)
      --include-types <types>         include only commits with these types (comma-separated)
      --no-categories                 flat list of all commits, no category grouping
      --no-contributors               hide contributors section
  -o, --output <path>                 output file           (default: CHANGELOG.md)
      --skip-authors <authors>        exclude these authors from contributors (comma-separated @logins)
      --title <title>                 custom changelog title
  -v, --version <version>             release tag

Environment variables

Variable Description
GITHUB_TOKEN GitHub API token (alternative to --auth)

Output format

### New Features

- **`feat(auth)`**: add OAuth2 login flow [`a1b2c3d`](https://github.com/…)

### Bug Fixes

- **`fix`**: resolve memory leak in cache [`e4f5g6h`](https://github.com/…)

**Contributors**: @alice, @bob

**Full changelog**: https://github.com/owner/repo/compare/v2.0.0..v2.1.0

If base_ref and head_ref resolve to the same commit (nothing changed since the last tag), or every commit gets filtered out, the output body is just - No changes were required. instead of an empty section list.

Programmatic API

getDefaultChangelog(repo, release?, config?)

High-level, returns a formatted markdown string.

import { getDefaultChangelog } from "./index.ts";

const md = await getDefaultChangelog(
  { name: "microsoft/vscode", base: "1.80.0", head: "1.81.0" },
  { tag: "v1.81.0" },
);
console.log(md);

getChangeLog(repo, base?, head?, config?)

Low-level, returns structured data for custom processing.

import { getChangeLog } from "./index.ts";

const { changes, _meta } = await getChangeLog("owner/repo", "v1.0.0", "v2.0.0");

for (const { title, commits } of changes) {
  console.log(`${title}: ${commits.length} commits`);
}

Return shape:

{
  changes: {
    commits: Commit[];
    count: number;
    name: string;
    title: string;
  }[];
  _meta: {
    commits: { all: Commit[]; base: Commit; count: number; groups: Record<string, Commit[]>; head: Commit };
    compareUrl: string;
    config: { default: Config; final: Config; input?: Config };
    contributors: string[];
    repo: { fullname: string; name: string; owner: string };
  };
}

Configuration

Config interface

interface Config {
  categories: {
    name: string;   // commit type to match
    title: string;  // section heading in the output
  }[];
  commits: {
    excludePatterns?: string[];
    excludeScopes?: string[];
    excludeTypes?: string[];
    includeNonConventional?: boolean;
    includePatterns?: string[];
    includeScopes?: string[];
    includeTypes?: string[];
  };
  contributors: {
    exclude: string[];
    includeBots: boolean;
  };
  noCategories?: boolean;
}

Default categories

Type Section
BREAKING Breaking Changes
build Builds
chore Chores
ci CI/CD
docs Documentation
feat New Features
fix Bug Fixes
perf Performance
refactor Refactors
revert Reverts
style Styles
test Tests

A commit lands in BREAKING instead of its usual type section when its header has a ! before the colon (feat!:, fix(api)!:, ...) or its body has a BREAKING CHANGE: (or BREAKING-CHANGE:) footer.

Custom configuration

import { getChangeLog, type Config } from "./index.ts";

const config: Config = {
  categories: [
    { name: "feat",     title: "Features" },
    { name: "fix",      title: "Fixes" },
    { name: "security", title: "Security" },
  ],
  commits: {
    excludePatterns: ["wip|draft|temp"],
    excludeTypes: ["chore", "test", "style"],
    includeScopes: ["ui", "api"],
  },
  contributors: {
    exclude: ["@dependabot"],
    includeBots: false,
  },
  noCategories: false,
};

const { changes, _meta } = await getChangeLog("owner/repo", "v1.0.0", "v2.0.0", config);

Commit filtering

commits: {
  includePatterns: ["SECURITY|HOTFIX"],  // include commits matching any of these regexes
  excludePatterns: ["wip|draft|temp"],   // exclude commits matching any of these regexes
  includeTypes:    ["feat", "fix"],      // include only these commit types
  excludeTypes:    ["chore", "test"],    // exclude these commit types
  includeScopes:   ["ui", "api"],        // include only these scopes
  excludeScopes:   ["tests", "docs"],    // exclude these scopes
  includeNonConventional: false,         // include commits without a type prefix
}

Authentication

# Via flag
ghlog owner/private-repo --auth ghp_your_token

# Via environment variable
export GITHUB_TOKEN=ghp_your_token
ghlog owner/private-repo

License

MIT