GithubHelp home page GithubHelp logo

pr_log's Introduction

PR Log

Gem Version Dependency Status Build Status Test Coverage Code Climate

Turn GitHub pull requests into changelog entries.

Assumptions

Changelogs should be written for humans by humans

PrLog does not try to auto generate a complete changelog. Instead, it pulls GitHub data to prefill your changelog as a baseline for manual editing. Add prose, order items by priority, insert headers.

Merged pull requests fully describe project history

PrLog ignores GitHub issues. If a pull request fixes an important issue it can reference it in its title or description.

Pull requests are tagged with version milestones

PrLog expects pull requests to be assigned to version milestones like v1.1. This ensures consistency with the issue tracker and helps limit GitHub API requests to relevant data.

Changelogs are written in Markdown

Markdown is the de facto standard for formatting files to be displayed on GitHub.

Installation

Install the command line tool:

$ gem install pr_log

Generate a personal access token and place it in a .pr_log.yml file in your home directory:

# ~/.pr_log.yml
access_token: "xxx"

Usage

To insert items for new pull requests with milestone v.1.2 into your CHANGELOG.md file run:

$ prlog fetch --github-repository some/repository --milestone v1.2

By default, this creates entries of the form:

- Title of the pull request
  ([#100](https://github.com/some/repository/pull/100)))

If a pull request URL is already mentioned in the changelog, no entry will be created.

Convention over Configuration

The fetch command can also be invoked without command line options:

$ prlog fetch

PrLog tries to derive defaults from gemspec information:

  • If the homepage attribute mentions the URL of the github repository, it is used to determine the github repository name.
  • PrLog constructs a milestone name of the form v%{major}.%{minor} from the current gem version.

Configuration

To override PrLog's default configuration you can either pass command line options or place a .pr_log.yml file inside your project's root or your home directory:

# .pr_log.yml
changelog_file: "HISTORY.md"

The following configuration options are available:

  • access_token: Personal access token to use for GitHub API requests.

  • changelog_file: Relative path to the changelog file.

  • entry_template: Template string used for new changelog entries. All fields from the issue search response can be used as interpolations.

  • github_repository: Name of the GitHub repository of the form user/repository.

  • insert_after: Regular expression or string matching the line inside the changelog after which new items shall be inserted.

  • label_prefixes: A hash mapping GitHub label names to title prefixes for changelog entries. See below for details.

  • milestone: Name of the milestone filter fetched pull requests by.

  • milestone_format: Template string used to derive a milestone name from the current gem version. The strings %{major}, %{minor} and %{patch} are replaces with the corresponding numeric component of the current version. Default value: v%{major}.%{minor}.

Label Prefixes

Items for pull requests with certain labels can be prefixed with a string automatically. To add a "Bug fix:" prefix to all pull requests with the label bug, add the following lines to your configuration file:

# pr_log.yml
label_prefixes:
  bug: "Bug fix:"

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

Running the Test Suite

Ensure the environment variable PR_LOG_FIXTURE_OAUTH_TOKEN is set to a valid GitHub access token. Then run bin/rspec. The test suite uses VCR to record and replay requests to the GitHub API. Fixture data used by the test suite comes from the tf/pr_log_test_fixture repository.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/tf/pr_log. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

pr_log's People

Contributors

chuganzy avatar tf 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.