https://github.com/jimschubert/changelog

A changelog generator which uses GitHub's API for the details

https://github.com/jimschubert/changelog

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.7%) to scientific vocabulary

Keywords

changelog changelog-generator github golang hacktoberfest
Last synced: 6 months ago · JSON representation

Repository

A changelog generator which uses GitHub's API for the details

Basic Info
  • Host: GitHub
  • Owner: jimschubert
  • License: apache-2.0
  • Language: Go
  • Default Branch: master
  • Homepage:
  • Size: 121 KB
Statistics
  • Stars: 9
  • Watchers: 1
  • Forks: 1
  • Open Issues: 4
  • Releases: 10
Topics
changelog changelog-generator github golang hacktoberfest
Created almost 6 years ago · Last pushed 9 months ago
Metadata Files
Readme Changelog Contributing Funding License Code of conduct

README.md

GitHub Changelog Generator

Apache 2.0 License Go Version Go Go Report Card Docker Pulls Lines of Code

Changelog is a cross-platform changelog generator for GitHub repositories. It queries between any two git branches or tags as supported by the GitHub Commits API, and generates a changelog of commits between the two. It supports templates for those who want more control over generated output.

Changelog's more advanced features support excluding commits from the changelog and grouping commits by heading based on regular expression patterns.

Usage

A GITHUB_TOKEN environment variable must be provided for changelog to operate effectively.

``` Usage: changelog [OPTIONS]

Application Options: -o, --owner= GitHub Owner/Org name (required) [$GITHUBOWNER] -r, --repo= GitHub Repo name (required) [$GITHUBREPO] -f, --from= Begin changelog from this commit or tag -t, --to= End changelog at this commit or tag (default: master) -c, --config= Config file location for more advanced options beyond defaults -l, --local Prefer local commits when gathering commit logs (as opposed to querying via API) --max= The maximum number of commits to include -v, --version Display version information

Help Options: -h, --help Show this help message ```

The changelog output is written to standard output and can be redirected to overwrite or append to a file.

Limitations

As this tool uses GitHub's comparison API for details, there are a few limitations to output:

  • Limited to 250 commits
  • Limited to 5000 API requests per hour

See the GitHub Commits API for additional details.

Basic

The changelog generator doesn't assume a start or end tag, and doesn't evaluate existing tags to determine tag order. If from and to options are not provided, your changelog will result in the single latest commit on master.

You may specify GITHUB_OWNER and GITHUB_REPO as environment variables for use in CI.

Examples

Output for single latest commit on master

bash ./changelog -o jimschubert -r changelog -f master~1 -t master

Output from some version to latest master

bash ./changelog -o jimschubert -r changelog -f v0.1

Sample output from one version to another

```bash ./changelog -o jimschubert -r kopper -f v0.0.2 -t v0.0.3

v0.0.3

For more details, see v0.0.2..v0.0.3 ```

Templating

The default template used in basic usage will output Markdown in flatten or grouped display (see later for configuration options). The template is defined as:

```gotemplate {{define "GroupTemplate" -}} {{- range .Grouped}}

{{ .Name }}

{{range .Items -}} * {{.CommitHashShort}} {{.Title}} ({{if .IsPull}}contributed by {{end}}{{.Author}}) {{end -}} {{end -}} {{end -}} {{define "FlatTemplate" -}} {{range .Items -}} * {{.CommitHashShort}} {{.Title}} ({{if .IsPull}}contributed by {{end}}{{.Author}}) {{end -}} {{end -}} {{define "DefaultTemplate" -}}

{{.Version}}

{{if len .Grouped -}} {{template "GroupTemplate" . -}}
{{- else}} {{template "FlatTemplate" . -}} {{end}} For more details, see {{.PreviousVersion}}..{{.Version}} {{end -}} {{template "DefaultTemplate" . -}} ```

Groupings will be displayed in the order they're defined in your external configuration.

You must define an external JSON configuration file to override the default template. For example, suppose you want to display flat commit history and link to diff, patch, and compare URLs. You could define a template like so:

```gotemplate

{{.Version}}

{{range .Items -}} * {{.CommitHashShort}} {{.Title}} ({{if .IsPull}}contributed by {{end}}{{.Author}}) {{end}}

Links

```

Install

Latest binary releases are available via GitHub Releases.

Docker

The preferred way to run changelog is via Docker. For example:

bash docker pull jimschubert/changelog:latest docker run -e GITHUB_TOKEN=yourtoken \ -e GITHUB_OWNER=jimschubert \ -e GITHUB_REPO=changelog \ jimschubert/changelog:latest -f v0.1 -t v0.2 >> CHANGELOG.md

Homebrew

brew tap jimschubert/tap brew install changelog

Advanced

More advanced scenarios require an external JSON configuration object which can be loaded by the --config option. The following example properties are supported by the config (comments added inline for brevity):

```json5 { // "commits" or "prs", defaults to commits. "prs" will soon allow for resolving labels // from pull requests "resolve": "commits",

// "asc" or "desc", determines the order of commits in the output "sort": "asc",

// GitHub user or org name "owner": "jimschubert",

// Repository name "repo": "changelog",

// Enterprise GitHub base url "enterprise": "https://ghe.example.com",

// Path to custom template following Go Text template syntax "template": "/path/to/your/template",

// Group commits by headings based on patterns supporting Perl syntax regex or plain text "groupings": [ { "name": "Contributions", "patterns": [ "(?i)\bfeat\b" ] } ],

// Exclude commits based on this set of patterns or texts // (useful for common maintenance commit messages) "exclude": [ "^(?i)release\s+\d+\.\d+\.\d+", "^(?i)minor fix\b", "^(?i)wip\b" ],

// Prefers local commits over API. Requires executing from within a Git repository. "local": false,

// Processes UP TO this many commits before processing exclusion/inclusion rules. Defaults to size returned from GitHub API. "max_commits": 250 } ```

Custom templating

Grouping is done by the name property of the groupings array objects, in the order in which groupings are declared. Groupings are displayed by default, but suppose you want to provide a custom template to display grouping differently. In this example, we'll only display the author name if the commit comes from a pull request.

First, create a directory at /tmp/changelog to contain a sample JSON and template.

Save the follow template as template.tmpl:

```gotemplate

{{.Version}}

{{range .Grouped -}}

{{ .Name }}

{{range .Items -}} * {{.CommitHashShort}} {{.Title}}{{if .IsPull}} (contributed by {{.Author}}){{end}} {{end}} {{end}}

For more details, see {{.PreviousVersion}}..{{.Version}} ```

Save the following as config.json (note: template currently requires a full path to the template file):

json { "sort": "desc", "template": "/tmp/changelog/template.tmpl", "groupings": [ { "name": "Fixes", "patterns": [ "(?i)\\bbug\\b", "(?i)\\bfix\\b" ] }, { "name": "Features", "patterns": [ "^(?i)feat:\\b", "^(?i)add:\\b" ] }, { "name": "Cleanup", "patterns": [ "(?i)\\brefactor:\\b" ] }, { "name": "Other Contributions", "patterns": [ ".?" ] } ], "exclude": [ "(?i)readme\\b", "(?i)\\b>\\b", "(?i)\\btypo\\b", "^usage$", "Bump dependencies", "minor", "slight" ] }

Now, run this against cli/cli v0.5.6 and v0.5.7. Via Docker:

bash docker run -e GITHUB_TOKEN=yourtoken \ -e GITHUB_OWNER=cli \ -e GITHUB_REPO=cli \ jimschubert/changelog:latest -f v0.5.6 -t v0.5.7 >> /tmp/changelog/CHANGELOG.md

And via cli:

bash export GITHUB_TOKEN=your-token ./changelog -o cli -r cli -f v0.5.6 -t v0.5.7 \ -c /tmp/changelog/config.json >> /tmp/changelog/CHANGELOG.md

This changelog output in /tmp/changelog/CHANGELOG.md should look like this:

```text

v0.5.7

Fixes

  • f9649ebddd Merge pull request #521 from yashLadha/bug/issuelistonnoremote (contributed by mislav)
  • 4ee995dafd fix(486): Getting issue list on no remotes specified
  • 4c3e498021 Fix column alignment and truncation for Eastern Asian languages

Other Contributions

For more details, see v0.5.6..v0.5.7 ```

Notice that this differs from the default in that it removes the committer name from the two commits in each section which were not pull requests.

Debugging

You may debug select operations such as groupings and exclusions by exporting LOG_LEVEL=debug.

License

This project is licensed under Apache 2.0.

Owner

  • Name: Jim Schubert
  • Login: jimschubert
  • Kind: user
  • Location: Richmond, VA

Trust me, I'm a pro. Things I know a little about: Go, Java, JavaScript, Scala, Kotlin, Frontend/Backend, Other things

GitHub Events

Total
  • Release event: 1
  • Delete event: 3
  • Issue comment event: 3
  • Push event: 10
  • Pull request event: 11
  • Create event: 6
Last Year
  • Release event: 1
  • Delete event: 3
  • Issue comment event: 3
  • Push event: 10
  • Pull request event: 11
  • Create event: 6

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 55
  • Total Committers: 1
  • Avg Commits per committer: 55.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Jim Schubert j****t@g****m 55

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 2
  • Total pull requests: 2
  • Average time to close issues: about 13 hours
  • Average time to close pull requests: about 10 hours
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 0.5
  • Average comments per pull request: 0.5
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 1
Past Year
  • Issues: 0
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 1
Top Authors
Issue Authors
  • jimschubert (2)
Pull Request Authors
  • dependabot[bot] (4)
  • jimschubert (2)
Top Labels
Issue Labels
bug (2)
Pull Request Labels
dependencies (4) github_actions (3)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 13
proxy.golang.org: github.com/jimschubert/changelog
  • Versions: 13
  • Dependent Packages: 0
  • Dependent Repositories: 1
Rankings
Dependent repos count: 4.7%
Dependent packages count: 9.6%
Average: 9.6%
Stargazers count: 10.8%
Forks count: 13.5%
Last synced: 6 months ago

Dependencies

go.mod go
  • github.com/go-git/go-git/v5 v5.0.0
  • github.com/goccy/go-yaml v1.4.3
  • github.com/google/go-github/v29 v29.0.3
  • github.com/jessevdk/go-flags v1.4.0
  • github.com/sirupsen/logrus v1.4.2
  • github.com/stretchr/testify v1.5.1
  • golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
go.sum go
  • github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7
  • github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239
  • github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5
  • github.com/creack/pty v1.1.9
  • github.com/davecgh/go-spew v1.1.0
  • github.com/davecgh/go-spew v1.1.1
  • github.com/emirpasic/gods v1.12.0
  • github.com/fatih/color v1.7.0
  • github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568
  • github.com/gliderlabs/ssh v0.2.2
  • github.com/go-git/gcfg v1.5.0
  • github.com/go-git/go-billy/v5 v5.0.0
  • github.com/go-git/go-git-fixtures/v4 v4.0.1
  • github.com/go-git/go-git/v5 v5.0.0
  • github.com/go-playground/locales v0.13.0
  • github.com/go-playground/universal-translator v0.17.0
  • github.com/goccy/go-yaml v1.4.3
  • github.com/golang/protobuf v1.3.2
  • github.com/google/go-cmp v0.3.0
  • github.com/google/go-github/v29 v29.0.3
  • github.com/google/go-querystring v1.0.0
  • github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99
  • github.com/jessevdk/go-flags v1.4.0
  • github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd
  • github.com/konsorten/go-windows-terminal-sequences v1.0.1
  • github.com/kr/pretty v0.1.0
  • github.com/kr/pty v1.1.1
  • github.com/kr/text v0.1.0
  • github.com/kr/text v0.2.0
  • github.com/leodido/go-urn v1.2.0
  • github.com/mattn/go-colorable v0.1.4
  • github.com/mattn/go-isatty v0.0.8
  • github.com/mattn/go-isatty v0.0.10
  • github.com/mitchellh/go-homedir v1.1.0
  • github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e
  • github.com/pkg/errors v0.8.1
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/sergi/go-diff v1.1.0
  • github.com/sirupsen/logrus v1.4.2
  • github.com/stretchr/objx v0.1.0
  • github.com/stretchr/objx v0.1.1
  • github.com/stretchr/testify v1.2.2
  • github.com/stretchr/testify v1.4.0
  • github.com/stretchr/testify v1.5.1
  • github.com/xanzy/ssh-agent v0.2.1
  • golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2
  • golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
  • golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073
  • golang.org/x/net v0.0.0-20190311183353-d8887717615a
  • golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3
  • golang.org/x/net v0.0.0-20200301022130-244492dfa37a
  • golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
  • golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
  • golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0
  • golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223
  • golang.org/x/sys v0.0.0-20190412213103-97732733099d
  • golang.org/x/sys v0.0.0-20190422165155-953cdadca894
  • golang.org/x/sys v0.0.0-20191008105621-543471e840be
  • golang.org/x/sys v0.0.0-20191010194322-b09406accb47
  • golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527
  • golang.org/x/text v0.3.0
  • golang.org/x/text v0.3.2
  • golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e
  • golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898
  • google.golang.org/appengine v1.1.0
  • gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
  • gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15
  • gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f
  • gopkg.in/go-playground/assert.v1 v1.2.1
  • gopkg.in/go-playground/validator.v9 v9.30.0
  • gopkg.in/warnings.v0 v0.1.2
  • gopkg.in/yaml.v2 v2.2.2
  • gopkg.in/yaml.v2 v2.2.4
  • gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2
.github/workflows/build.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/setup-go v2 composite
.github/workflows/release.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/checkout v1 composite
  • actions/setup-go v2 composite
  • goreleaser/goreleaser-action v2.4.1 composite
Dockerfile docker
  • gcr.io/distroless/base-debian10 latest build
  • golang 1.14-alpine3.11 build