GithubHelp home page GithubHelp logo

bahmutov / github-post-release Goto Github PK

View Code? Open in Web Editor NEW
18.0 1.0 0.0 127 KB

Forms release changelog and posts a note to each referenced issues after semantic release publishes a new module version

JavaScript 86.19% Shell 13.81%
semantic-release plugin github issue changelog

github-post-release's Introduction

github-post-release

Forms release changelog and posts a note to each referenced issues after semantic release publishes a new module version

NPM

Build status semantic-release js-standard-style next-update-travis badge

Problem

When publishing new version of your NPM package, it would be nice to comment on each GitHub issue referenced by the semantic commits, letting the user know that the fix / feature was published.

This module works as a semantic-release generate notes plugin. It both comments on referenced issues and returns the changelog to be posted on GitHub. Each issue will get a comment like this (example)

Typical comment

Install and use

Requires Node version 6 or above.

npm install --save-dev github-post-release

The postinstall script will automatically set this module to be the generateNotes plugin for the release. If you want you can do this manually:

{
  "release": {
    "generateNotes": "github-post-release"
  }
}

Message types

By default, the output message for issues will be "New version has been published to NPM ...". This might not match other scenarios when this plugin can be used. For example if you deploy a website and publish release notes to GitHub, you might like different text that does not mention NPM. There are two built-in message types: "npm", "deploy" and you can pick on to generate by configuring this plugin like this in package.json

{
  "release": {
    "generateNotes": {
      "path": "github-post-release",
      "type": "deploy"
    }
  }
}

Debug

To see more log messages, run this plugin with DEBUG=github-post-release flag. You can even demo the plugin locally (without actual GitHub updates) using npm run demo.

Related

It was inspired by semantic-release-github-notifier, release-notes-generator and uses conventional-changelog to generate changelog text after commenting on issues.

Small print

Author: Gleb Bahmutov <[email protected]> ยฉ 2017

License: MIT - do anything with the code, but don't blame me if it does not work.

Support: if you find any problems with this module, email / tweet / open issue on Github

MIT License

Copyright (c) 2017 Gleb Bahmutov <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

github-post-release's People

Contributors

bahmutov avatar tunnckocore avatar

Stargazers

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

Watchers

 avatar

github-post-release's Issues

Allow use on Travis

The way we get sorted tags to get the latest - does not work on Travis due to old git version that does not support --sort option bahmutov/ggit#47

Need to rework getting the commits since last tag, how does conventional-changelog do it?

Inspect pull request text

If a commit is semantic, but comes from the pull request, the message that it fixes a particular issue could be in the text of the pull request.

For example, pull request bahmutov/snap-shot-core#14 in its text says that it closes issue 13 (fixes #13), but because the commit itself does not say this, there is no message in the issue 13 that new version has been published.

The commit message in this case has pull request number bahmutov/snap-shot-core@85ac692

fix(store): escape values with jsesc (#14)

Should should inspect the commit message, find #14, see if this refers to the closed pull request, fetch the text of the pull request, and parse the text just like parsing commit message to find closed issues to comment on

Consider remove destructing?

Hi!

Can you consider removing the destruction? It is in very few places, mainly where the requires are. And in utils.js you have modules.exports that uses object shorthand syntax.

Want that, because it fails on Node 4 and i want to have support for it a bit more time.

scopeless commit, which passed validation with simple-commit-message generates an error on semantic-release post

I assume the issue is that scope is null, but it's optional for the https://github.com/bahmutov/simple-commit-message check. As a result it fails during release notes generation

semantic-release ERR! post Error: invalid commit format {
semantic-release ERR! post   "firstLine": "major: first release",
semantic-release ERR! post   "type": "major",
semantic-release ERR! post   "scope": null,
semantic-release ERR! post   "subject": "first release",
semantic-release ERR! post   "id": "8e298fcb72441f33ef12de67312f5fed8e665ce4"
semantic-release ERR! post }

Crashes semantic release v15

with message

[Semantic release]: An error occurred while running semantic-release: { TypeError: Cannot read property 'repository' of undefined
    at githubPostRelease (/home/travis/build/bahmutov/snap-shot-it/node_modules/github-post-release/src/index.js:123:23)
    at Object.defineProperty (/home/travis/build/bahmutov/snap-shot-it/node_modules/semantic-release/lib/plugins/normalize.js:44:30)

for example https://travis-ci.org/bahmutov/snap-shot-it/builds/352854491

A test issue

Just a test issue post release should comment on

Be a little forgiving

In cases there are no semantic commits, but this plugin was called, be a little more forgiving. Instead of generating no text, if the number of commits is small (< 5 for example), just put all commits into a bullet point list

Make repo url https

Otherwise, if the url is repo url git+https://github.com/bahmutov/github-post-release.git for example, it cannot load the module to follow redirects when trying to call from github module! ๐Ÿ˜Ÿ

Example CI output https://travis-ci.org/bahmutov/github-post-release/builds/251286225

{ version: '3.0.0',
  port: null,
  protocol: 'git+https',
  host: 'github.com' }
Could not comment on issue 1
{ Error: Cannot find module 'follow-redirects/git+https'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at httpSendRequest (/home/travis/build/bahmutov/github-post-release/node_modules/github/lib/index.js:774:23)

Add package name to the release version

Situation: package has been renamed. New version has been published at 1.0.0, but there was a previous 1.2.0 version under a different name. Need to put the name with the version

screen shot 2017-08-23 at 10 13 37 am

Generate changelog

Need to generate changelog for github

const changelog = require('conventional-changelog')
const parseUrl = require('github-url-from-git')

module.exports = function (pluginConfig, {pkg}, cb) {
  const repository = pkg.repository ? parseUrl(pkg.repository.url) : null

  changelog({
    version: pkg.version,
    repository: repository,
    file: false
  }, cb)
}

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.