lob / generate-changelog Goto Github PK
View Code? Open in Web Editor NEWGenerate a changelog from git commits.
License: MIT License
Generate a changelog from git commits.
License: MIT License
Its not generating correct url for bitbucket commits
In git the commit url has the following format:
nodejs/node@96e8e869c0
(notice the 'commit' stirng in url)
The same commit in bitbucket will have an extra 's' in 'commit':
https://bitbucket.org/nodejs/node/commits/96e8e869c0
(notice the 'commits' stirng in url)
Take a look at it
Creating changelogs requires semantic commit messages and the execution of changelog -M
, changelog -m
or changelog -p
. Is there also possibility to create a changelog from a commit range?
I am thinking of something like: changelog 420c945...2a83752
.
GitHub supports showing a comparison of two SHA1 hashes, like:
The scenario is that I'm doing some commits (lets say commits docs(A): [commit message for A]
and docs(B): [commit message for B]
), and them I'm running:
changelog -M && git add CHANGELOG.md && git commit -M 'updated CHANGELOG.md' && npm version major
Then I'm making more commits (lets say commits docs(C): [commit message for C]
and docs(D): [commit message for D]
), and them I'm running the same command again.
The changelog output that I'm getting is:
D:
C:
B:
A:
B:
A:
I would expect A and B not to appear in versoin 2.0.0. How does generate-changlog
know where to cut the commits between version? How can I make sure that commits from the previous version won't be part of the next version?
Sometimes we need to cusomize the template, e.g. use another translation for the headings, or re-arrange the orders of them. An example provided by https://github.com/cookpete/auto-changelog:
Hi,
It would be really cool if the PR numbers in the changelog would be links to the PRs, just like the commit messages are links to the commits.
I'd even be willing to look into this myself if you can point me to the right lines of code :)
Hi there, I was checking out the options and wanted to try out exclude which works totally fine on specified types.
But it does not work when it comes to excluding 'other' type. What I mean by the other is which I've already committed before using this package.
Can anyone confirm?
Thanks
What about adding a way to register custom types?
Shouldn't be difficult to add and would be nice for people who don't want their custom types to all be dumped under "other"?
GitHub has the functionality to revert a Pull Request. In this case an automatic PR title will be generted. This title has the format of: Revert "the original commit message"
. It would be cool if "generate-changelog" removes the original commit message from the log if a reverting commit is found afterwards. ๐
Example commit message:
chore(deps): Bump @types/generate-changelog from 1.8.0 to 1.8.1
Reverting commit message:
Revert "chore(deps): Bump @types/generate-changelog from 1.8.0 to 1.8.1"
The convention for breaking changes in conventional commits would be BREAKING CHANGE: commit message
https://www.conventionalcommits.org/en/v1.0.0-beta.2/
If you wish to use this library in conjunction with others they will not play nicely together. (E.G. https://github.com/probot/semantic-pull-requests)
I'm importing this package into my code and trying to generate a changelog with tags. It always excludes the tagged commits and includes everything between the beginning and end.
It would be nice if you could provide an option or flag to include the tagged commits into the changelog.
E.g.,
Currently
Commit1
Commit2
Commit3
Commit4
Commit5
Commit1 and Commit 5 are excluded from the changelog.
It would be nice if you could provide an option to include them.
Can I put out a PR for that change?
Hello,
I've tried to use generate-changelog for my non nodejs project but it fails with Error: valid package.json not found
. I've looked through the issues of this repository and found Fails when no version is specified in package.json #24 and I can't really understand why there's a need for package.json at all if all you need to get list of changes for parsing is git log v0.1...HEAD --pretty=format:'%H: %s' --reverse
called from bash.
Before submitting a PR, what are your thoughts for supporting npm version
. This would have the benefit of working directly within existing npm scripting flows. Also this module could then leverage the npm variables exposed for getting/updating the version which would allow for support of various types of releases beyond major, minor, and patch.
The main concern I can see is supporting workflows for generating a change log outside of versioning... although that doesn't seem like a normal use case.
Instead of commit messages like this:
feat: xxx
closes #29
We used to write the full link to the issue like this:
feat: xxx
closes https://github.com/kalisio/k-vigicrues/issues/29
Github handles tihs smoothly (eg kalisio/k-vigicrues@bcf2dff) but the text formatting of the changelog seems to break with such messages:
I'm getting the following error on a mac system:
[Error: no commits found]
There were 3 commits in the repo when I first saw the issue, and I added two more commits to test, but itt still wouldn't work.
When there are two merges with the same message, then "generate-changelog" displays them like this:
##### Bug Fixes
- **util:**
- Add line breaks before config logging ([b79904ba](https://github.com/bennycode/project/commit/b79904bac5580e41a15f73cb45644ad70267c712))
- Add line breaks before config logging ([8c4ab208](https://github.com/bennycode/project/commit/8c4ab20898e12df44c629bf1180fd854dbbd6646))
It would be much cooler, if it would merge these:
##### Bug Fixes
- **util:**
- Add line breaks before config logging ([b79904ba](https://github.com/bennycode/project/commit/b79904bac5580e41a15f73cb45644ad70267c712), [8c4ab208](https://github.com/bennycode/project/commit/8c4ab20898e12df44c629bf1180fd854dbbd6646))
Its amazing!!
It would be awesome if I could filter and exclude them by category
Would you accept a PR?
Error description
Installed generate-changelog
globally and after running it in a repository which doesn't have a version
field in the package.json
file, I get the following error:
TypeError: Cannot read property 'split' of undefined
.
System specs
Linux Debian 9, Node.js 8.4.0 (installed with nvm), npm 5.3.0, git 2.11.0.
Full log
$ changelog -M
TypeError: Cannot read property 'split' of undefined
at /home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/lib/package.js:55:36
at tryCatcher (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/promise.js:693:18)
at Promise._fulfill (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/promise.js:638:18)
at Promise._settlePromise (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/promise.js:582:21)
at Promise._settlePromise0 (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/promise.js:693:18)
at Promise._fulfill (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/promise.js:638:18)
at Promise._resolveCallback (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/promise.js:432:57)
at Promise._settlePromiseFromHandler (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/promise.js:524:17)
at Promise._settlePromise (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/home/florian/.nvm/versions/node/v8.4.0/lib/node_modules/generate-changelog/node_modules/bluebird/js/release/promise.js:693:18)
I'm using the Pull Request strategy for my project and everytime a new request is approved and merged into master there are 2 commits, the initial one and a "merge commit". In this case the changelog appears empty. Somehow it doesn't like the merge commit. Any idea how to get around this? I can't get rid of the merge commit.
I can pull request to add support commits without category?
git commit -m "feat: some text 1"
git commit -m "feat(): some text 2"
git commit -m "feat(abc): some text 3"
#### 0.0.1 (2016-9-22)
##### New Features
* some text 1 (7cd910d0)
* some text 2 (7cd910d0)
* **abc:** some text 3 (7cd910d0)
Hello guys and thank you for a wonderful package!
I am experiencing some issues though if running commit from within a submodule directory.
(node:16959) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOTDIR: not a directory, open '/home/ubuntu/path/to/repository/submodule/.git/COMMIT_EDITMSG' [edited for bug report]
(node:16959) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Nonetheless I believe that script is right because hooks for submodules are located under ../.git/modules/submodule/hooks
and therefore COMMIT_EDITMSG
file would never appear under submodule/.git/COMMIT_EDITMSG
and submodule/.git
is file, that's true as well ;)
I cannot give a time to resolve it by myself at the moment but will hopefully provide a solution somehow later as a contributor.
Forgot to add. I am using generate-changelog together with commitizen so it may not be a bug in generate-changelog at all.
Hi,
Can you add support to display breaking change in the final changelog ?
I use commitizen to add breaking.
Thanks ;)
Why not combine committees with the same text? For example instead of:
- chrore: add some tests (aaa)
- chrore: add some tests (bbb)
- chrore: add some tests (ccc)
we would get it:
- chrore: add some tests (aaa), (bbb), (ccc)
This combination made the story much more compact and easier to read
I wanted to flag this issue, it might be affecting other people than me.
I have a repository named panic-fe
, and this yml syntax:
- name: Production -- Generate Changelog
if: env.GIT_DIFF == ''
uses: scottbrenner/generate-changelog-action@master
id: Changelog
env:
REPO: ${{ github.repository }}
The commit links being rendered look like this for each commit:
https://github.com/niall-byrne/panic-fe/releases/tag/v0.11
My pushy friend made me rename the repository to panic_fe temporarily, so that a github redirect would enable the links to work, but I suspect the author's intention was that they would be rendered differently.
(To Recreate: Look at the rendered HTML to see the actual link, as my hacky github redirect workaround will disguise the issue...)
Would it be possible to include the commiter of a changeset in the changelog?
Hello,
We have a large codebase we're trying to apply this tool to. I'm getting the "No commits found" error, but after doing a little debugging in the lib, I discovered that it's not failing to find commits but rather finding way too many commits.
Thoughts? I'll keep digging to see if there's anything node offers to get around this. Thanks!
Currently, the release version on the starting of changelog will always be the HEAD version in package.json, no matter what range I specify, which is bad. Users may need to generate changelog for some historical versions.
Today, has not option in require('generate-changelog').generate;
to generate a version with a build number of this version. Something like: 4.0.0-1
where -1
is a version number as 1.
I mean, there's should an option like this way:
// v4.0.0-1
require('generate-changelog').generate({ build: true });
what do you think?
I'm already doing this.
It would be nice, if generate-changelog will support cz-emoji.
Support smiles in commit messages. cz-emoji โ commitizen-compatible npm package.
I install commitizen and cz-emoji โ I create any commit to my GitHub repository via cz-emoji โ I run command changelog -f -
.
Successful changelog generation.
Blank changelog, example:
D:\SashaBranchReleaseIt>changelog -f -
#### 2.0.1 (2018-01-29)
Thanks.
I am getting an "undefined" printed in the changelog, cause the commit message was and old one not following the format required by generate-changelog
##### Bug Fixes
* **undefined:** remove reference...
That was generated from "Fix: remove reference..."
So it was missing the category capture group.
So https://github.com/lob/generate-changelog/blob/master/lib/git.js#L50 should look like this:
commit.category = parsed[3] || "";
Why do you capture a 3rd capture group that includes the catagory
in braces (category)
. Its not used anywhere.
How about this match pattern?
https://regex101.com/r/tB8sV4/2
It captures 3/2 groups: type/[category]/subject
Hi @lob
Greetings.
I was wondering if this tool could be used for a project that not uses a package.json
, perhaps a python project. I could use the GitHub action, but the package.json
requirement is a concern for me.
I have three components in the same repository. It would be awesome if I could filter them by path (git log -- <path>
), so I can generate three different CHANGELOG files (one for each component)
Any plans to add this? Would you accept a PR?
Whenever we add new changelog ,it generates whole commit message again in the CHANGELOG.md file. It leads to duplication of data for example.
lets say I have some commits,
commit one
commit two
commit three
commit four
commit one
commit two
commit one
commit two
commit three
commit four
Hi,
I testing your great tool but when I tried to launch the recommanded command it fails, in my react project.
So I added in my package.json :
"release:major": "changelog -M && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version major && git push origin && git push origin --tags"
The version is ok.
My git status :
$ git status
On branch dev-react-website
Your branch is ahead of 'origin/dev-react-website' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
When I tried to do a yarn release:major
, I have this :
yarn run v1.19.1
$ changelog -M && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version major
warning: LF will be replaced by CRLF in CHANGELOG.md.
The file will have its original line endings in your working directory
error: pathspec 'CHANGELOG.md'' did not match any file(s) known to git
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I installed the package globally to test each command separately and it's working but not with the entire command.
Why there is 2 apostrophes after CHANGELOG.md : error: pathspec 'CHANGELOG.md''
EDIT :
If I do :
$changelog -M && git add CHANGELOG.md && git commit -m 'updated CHANGELOG.md' && npm version major && git push origin && git push origin --tags
It's working but not with :
$ yarn release:major
Thanks by advance.
I have tried passing every format of comma separated list I can even imagine, and I still get:
.npm-packages/lib/node_modules/generate-changelog/lib/cli.js:8
return val.split(',');
Maybe I'm just totally blanking on the format, but I have tried a zillion combinations. Here are a few:
changelog -p -x [chore, test]
changelog -p -x ['chore', 'test']
changelog -p -x chore, test
changelog -p -x "chore, test"
changelog -p -x 'chore', 'test'
changelog -p, -x=[chore]
etc.
I'm probably just doing it wrong, but thought I would ask.
Thanks.
I am getting an error when requesting a changelog with in the range. But I am getting commits in commandline by executing git log -E --format=%H%n%s%n%b%n===END=== v2.0.0-alpha.12..v2.0.0-alpha.17
.
generateLog.generate(<generateLog.Options>{
patch: true,
major: true,
tag: 'v2.0.0-alpha.12..v2.0.0-alpha.17',
repoUrl: repositoryUrl
}).then((changeLog) => {
console.log(changeLog);
}).catch((err) => {
console.error(err);
});
I get the following error:
Note: I printed out error by changing line 44 of git.js
throw new Error('no commits found \n' + err);
Error: no commits found
Error: Command failed: git log -E --format=%H%n%s%n%b%n===END=== v2.0.0-alpha.12..v2.0.0-alpha.17
fatal: ambiguous argument 'v2.0.0-alpha.12..v2.0.0-alpha.17': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
at M:\change-log\node_modules\generate-changelog\lib\git.js:44:11
at tryCatcher (M:\change-log\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (M:\change-log\node_modules\bluebird\js\release\promise.js:512:31)
at Promise._settlePromise (M:\change-log\node_modules\bluebird\js\release\promise.js:569:18)
at Promise._settlePromise0 (M:\change-log\node_modules\bluebird\js\release\promise.js:614:10)
at Promise._settlePromises (M:\change-log\node_modules\bluebird\js\release\promise.js:690:18)
at _drainQueueStep (M:\change-log\node_modules\bluebird\js\release\async.js:138:12)
at _drainQueue (M:\change-log\node_modules\bluebird\js\release\async.js:131:9)
at Async._drainQueues (M:\change-log\node_modules\bluebird\js\release\async.js:147:5)
at Immediate.Async.drainQueues [as _onImmediate] (M:\change-log\node_modules\bluebird\js\release\async.js:17:14)
at runCallback (timers.js:696:18)
at tryOnImmediate (timers.js:667:5)
at processImmediate (timers.js:649:5)
at process.topLevelDomainCallback (domain.js:121:23)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.