ScottBrenner/generate-changelog-action

CHANGELOG is not displayed

locona opened this issue · 2 comments

Hi @ScottBrenner
How do you operate this?

I tried adding this to github action,
CHANGELOG is displayed empty.

Do you know what the cause is?

Shouldn't I use on.push.tags ?

My repository: https://github.com/locona/auto-king

I did the following steps.

git commit -m "feat: xxxxxxxx"
git commit -m "1.0.9"
git tag v1.0.9
git push origin --tags

git log

92d5c7e (HEAD -> master) 1.0.9
f06b74e fix: ci
96c15ba feat: ci
07c5b17 (tag: v1.0.8) 1.0.8
e5b52de feat: ci
af0c690 fix(category): ci
f194d3e fix
aca0428 (tag: v1.0.7, origin/master) 1.0.7
e0eb0a8 fix(category): ci
6e906f0 fix(category): ci
3989e68 (tag: v1.0.6) 1.0.6
bc88fc1 feat: ci
f030913 fix: ci
62b2136 (tag: v1.0.5) feat: ci
310a1d7 fix: ci
39f267c 1.0.5
af6056c (tag: v1.0.4) 1.0.4
ead299a fix: ci
8de5d79 feat: ci
0d73576 (tag: v1.0.3) 1.0.3
279b8d0 (tag: v1.0.2) fix(functions): Fix viewport
41519cb (tag: v1.0.1, tag: v1.0.0) build(github-action): Create-Release

I am able to generate changelogs for your repository from the master branch:

auto-king$ git branch
* master
auto-king$ generate-changelog --file -
#### 1.0.9 (2020-08-29)

##### New Features

*  ci (96c15ba8)

##### Bug Fixes

*  ci (f06b74e2)

and can reproduce empty changelogs with a tag checked out:

auto-king$ git checkout v1.0.7
Note: checking out 'v1.0.7'.
...
HEAD is now at aca0428 1.0.7
auto-king$ generate-changelog --file -
#### 1.0.7 (2020-08-29)

I'm not sure what is causing this, but it may be related to lob/generate-changelog#60.

Although following https://github.com/lob/generate-changelog#generate-changelog

This is meant to be used so that for every patch, minor, or major version, you update the changelog prior to running npm version so that the git tag contains the commit that updated both the changelog and version.

I believe this is supposed to run before the tag is created - but you are running it after the tag is created, so it does not work properly.

It's a suggestion,
How about specifying the latest tag and the previous tag as options?

like

generate-changelog -t $(git tag --sort version:refname | tail -n 2 | head -n 1) --file -

and next action
major, minor, patch release Allow comparison with the previous version.

For example

> current tags
v1.0.0
v1.0.1
v1.0.2
v2.0.0
v1.1.0
  • case major release(v3.0.0): v2.0.0...v3.0.0
  • case minor release(v1.1.1): v1.1.0...v1.1.1
  • case patch release(v1.0.3): v1.0.2...v1.0.3