Code Monkey home page Code Monkey logo

neo4j-changelog's Introduction

Neo4j-Changelog

A tool to generate changelogs based on GitHub pull requests. As far as this tool is concerned, every entry in the changelog corresponds to one PR on GitHub.

The major feature of neo4j-changelog is the fact that it actually uses git to figure out which version a PR belongs to. Thus there is never any need to "figure out" which version a change was first introduced in, the tool will do all that for you.

As a result it becomes easy to generate changelog for multiple versions, even if you are running parallel branches where some PRs are effectively merged into several branches.

Cloning

This repo uses a submodule so the best way is to do

git clone --recursive https://github.com/neo4j/neo4j-changelog.git

or if you read this after your first build failed (due to a missing submodule), do this

git clone https://github.com/neo4j/neo4j-changelog.git
cd neo4j-changelog
git submodule update --init --recursive

How to build

Use ./gradlew tasks to list possible tasks. But you probably want either

  • installDist which will build a runnable script for you at build/install/neo4j-changelog

  • distTar or distZip which builds a runnable script and packages it up for you under build/distributions

You can then just run the executable under build/install/neo4j-changelog/bin/neo4j-changelog.

How to use

Output of neo4j-changelog --help:

usage: neo4j-changelog [-h] [-c CONFIG]

Generate changelog for the given project.

optional arguments:
  -h, --help             show this help message and exit
  -c CONFIG, --config CONFIG
                         Path to config file (default: changelog.toml)

Please see sample-changelog.toml for a complete sample config file.

How to label PRs

To avoid terminology confusion, label refers to GitHub Issue/PullRequest labels, the ones you assign to PRs through the GitHub GUI. tag refers to a piece of text inside the brackets of a PR description. release refers to what is specified as releases by GitHub, equivalent to git tags.

Only PRs with the label(s) configured in requiredlabels are downloaded from github. From these, a merge-commit is extracted to determine where (if at all) the PR belongs in the change log. So as to not consider ALL PRs, it is recommended to label those PRs (with a GitHub Label) that should be mentioned in the change log with for example "changelog".

Additional meta-data is also parsed from the PR's description.

Extra meta-data format

It is possible to override the metadata associated with a PR by adding some text to the message body of the PR, such as

changelog: [3.4, packaging] This is a better message

which override the PR's GitHub labels, and the PR title. Versions inside the brackets can be used to limit the inclusion of a change in case it was null-forward-merged.

Each PR is sorted under the earliest (by semantic version) release from which the PR's head commit is reachable. E.g., each PR is placed under first release which occurs after the relevant merge commit. If no such release exists, it is placed under nextheader.

An exception is if any versions were specified with the changelog tag in the PR message. If so, that version is compared to versionprefix from the config.

Each PR is sorted under a category (categories in config). The first GitHub label, or tag if present, to match one of the categories will be used. If no match is found, it is placed under Misc.

Meta-data examples

Some examples are the best way to illustrate.

A change should be placed under packaging, but the change is only present in 3.3 and 3.4 (e.g. it was null forward merged to 3.5) and we want the changelog to state "Some fixes to Load CSV" instead of whatever the PR title is:

changelog: [3.3, 3.4, packaging] Some fixes to Load CSV

The colon after changelog is optional, and it is also OK to write cl instead, so the following is perfectly equivalent:

cl [3.3, 3.4, packaging] Some fixes to Load CSV

In fact, we could also have placed it across several lines such as

changelog
[3.3, 3.4, packaging]
Some fixes to Load CSV

New lines within the changelog message should however be avoided. This will cause an empty line between to and Load in the generated changelog:

cl [3.3, 3.4, packaging] Some fixes to 
Load CSV

Each individual piece is of course optional, so if we are fine with the title of PR being listed in the changelog we could just write:

CHANGELOG:[3.3,3.4,packaging]

The spacing and case don't matter. Similarly, if the PR is already tagged correctly and it was not null-merged anywhere, but we are not OK with the title, this would be fine:

cl: Some fixes to Load CSV

A separate PR for the same fix was raised for each of version 3.3, 3.4 and 3.5. To avoid duplicate entries in the changelogs of 3.4 and 3.5, they should have these changelog messages, respectively:

cl: [3.3] Some fixes to Load CSV
cl: [3.4] Some fixes to Load CSV
cl: [3.5] Some fixes to Load CSV

A PR solves a Github issue, which should be linked to from the changelog:

cl: Fixes an [issue](https://github.com/neo4j/neo4j/issues/12345) with Load CSV

In case you were wondering, writing nothing will be ignored. These are all equivalent, and they are effectively ignored when parsed:

changelog:
cl:
CHANGELOG
Cl
ChAngELog []
cL[]

neo4j-changelog's People

Contributors

fbiville avatar lojjs avatar spacecowboy avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.