Giter Site home page Giter Site logo

apheris / cz-github-jira-conventional Goto Github PK

View Code? Open in Web Editor NEW
21.0 4.0 14.0 22 KB

Extend the commitizen tools to create conventional commits and CHANGELOG that link to Jira and GitHub.

License: MIT License

Python 100.00%
conventional-commits git commitizen

cz-github-jira-conventional's Introduction

cz-github-jira-conventional

cz-github-jira-conventional is a plugin for the commitizen tools, a toolset that helps you to create conventional commit messages. Since the structure of conventional commits messages is standardized they are machine readable and allow commitizen to automaticially calculate and tag semantic version numbers as well as create CHANGELOG.md files for your releases.

This plugin extends the commitizen tools by:

  • require a Jira issue id in the commit message
  • create links to GitHub commits in the CHANGELOG.md
  • create links to Jira issues in the CHANGELOG.md

When you call commitizen commit you will be required you to enter the scope of your commit as a Jira issue id (or multiple issue ids, prefixed or without prefix, see config below).

> cz commit
? Select the type of change you are committing fix: A bug fix. Correlates with PATCH in SemVer
? JIRA issue number (multiple "42, 123"). XX-
...

The changelog created by cz (cz bump --changelog)will contain links to the commits in Github and the Jira issues.

## v1.0.0 (2021-08-06)

### Features

- **[XX-123](https://myproject.atlassian.net/browse/XX-123)**: create changelogs with links to issues and commits [a374b](https://github.com/apheris/cz-github-jira-conventional/commit/a374b93f39327964f5ab5290252b795647906008)
- **[XX-42](https://myproject.atlassian.net/browse/XX-42),[XX-13](https://myproject.atlassian.net/browse/XX-13)**: allow multiple issue to be referenced in the commit [07ab0](https://github.com/apheris/cz-github-jira-conventional/commit/07ab0e09de36712ab1db93fff0c821ecd80b5849)

Installation

Install with pip python -m pip install cz-github-jira-conventional

You need to use a cz config file that has the required additional values jira_base_url and github_repo and may contain the optional value jira_prefix.

Example .cz.yaml config for this repository

commitizen:
  name: cz_github_jira_conventional
  tag_format: v$version
  version: 1.0.0
  jira_prefix: XX-
  jira_base_url: https://myproject.atlassian.net
  github_repo: apheris/cz-github-jira-conventional

The jira_prefix can be either

  • empty (the user must write the prefix for each issue)
  • a string (the prefix will be added automatically)
  • a list (for multiple projects, the user will be asked to choose a prefix)
  jira_prefix: 
    - XX-
    - XY-
    - YY-

pre-commit

Add this plugin to the dependencies of your commit message linting with pre-commit.

Example .pre-commit-config.yaml file.

repos:
  - repo: https://github.com/commitizen-tools/commitizen
    rev: v2.17.13
    hooks:
      - id: commitizen
        stages: [commit-msg]
        additional_dependencies: [cz-github-jira-conventional]

Install the hook with

pre-commit install --hook-type commit-msg

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements

This plugin would not have been possible without the fantastic work from:

cz-github-jira-conventional's People

Contributors

falko-apheris avatar g2010a avatar huckebein79 avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

cz-github-jira-conventional's Issues

Make `scope` (jira ticket) optional

I am really enjoying this solution. Thanks!
In some cases, it is necessary to perform a quick update that doe snot require version bump (style, docs etc.).
But the scope is always required.

Ideally, it would be possible to have it as optional, only generating the changelog links IF the user provides the scope.

Change commit pattern to start with Jira Ticket

Currently, the Jira Ticket has to be included in the scope of a commit, which builds the links in the changelog.
But that means it does not support the Jira-Github integration that auto-links a commit directly to its respective ticket.

My understanding is, for that to work, the ticket identifier must be placed at the start of the commit message.
Here is an example:
image

Can the Jira Ticket be moved to the start of the commit message, then the action, then the scope? Something like the following:
<jira_ticket?><bump_pattern><(scope)?>: <commit_message>

Where:

  • jira_ticket: optional
  • bump_pattern: required, from a list of accepted values
  • scope: optional
  • commit_message: required

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.