changelog-generator
changelog-generator copied to clipboard
A GitHub Action that compares the commit differences between two branches
Changelog Generator
This Action returns a markdown formatted changelog between two git references. There are other projects that use milestones, labeled PRs, etc. Those are just to much work for simple projects.
I just wanted a simple way to populate the body of a GitHub Release.
- name: Generate changelog
id: changelog
uses: jaywcjlove/changelog-generator@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
filter-author: (jaywcjlove|小弟调调™|dependabot|renovate\\[bot\\]|dependabot\\[bot\\]|Renovate Bot)
filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'
Then you can to use the resulting changelog.
- name: Get the changelog
run: echo "${{ steps.changelog.outputs.changelog }}"
- name: Create Release
uses: ncipollo/release-action@v1
if: steps.create_tag.outputs.successful
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.create_tag.outputs.version }}
tag: ${{ steps.create_tag.outputs.version }}
body: |
${{ steps.changelog.outputs.compareurl }}
${{ steps.changelog.outputs.changelog }}
Document Website: https://raw.githack.com/jaywcjlove/changelog-generator/${{ steps.changelog.outputs.gh-pages-short-hash }}/index.html
GETTING STARTED
Only use the following Git Commit Messages. A simple and small footprint is critical here.
- 🌟
featUse when you add something entirely new. E.g:feat(Button): add type props. - 🐞
fixUse when you fix a bug — need I say more? E.g.fix: Case conversion. - 📖
doc/docsUse when you add documentation like README.md, or even inline docs. E.g.doc(Color): API Interface. - 💄
choreChanges to the build process or auxiliary tools. E.g.chore(Color): API Interface. - 🎨
styleFormat (changes that do not affect code execution). E.g.style(Alert): API Interface. - 🆎
typeTypescript type bug fixes. E.g.type(Alert): fix type error. - ⛑
testAdd and modify test cases. E.g.test(Alert): Add test case. - 🐝
refactorRefactoring (i.e. code changes that are not new additions or bug fixes). E.g.refactor(Alert): API Interface. - 🌍
websiteDocumentation website changes. E.g.website(Alert): Add example. - 🔙
revertRevert last commit. E.g.revert: Add test case. - 💊
cleanclean up. E.g.clean: remove comment code. - 📈
perfChange the code to improve performance. E.g.revert: Add test case. - 💢
ciContinuous integration related file modification. E.g.ci: Update workflows config. - 🧯
buildChanges that affect the build system or external dependencies (example scopes: gulp, webpack, vite, npm)
<type>(<scope>): <short summary>
│ │ │
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
│ │
│ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core|
│ elements|forms|http|language-service|localize|platform-browser|
│ platform-browser-dynamic|platform-server|router|service-worker|
│ upgrade|zone.js|packaging|changelog|docs-infra|migrations|ngcc|ve|
│ devtools....
│
└─⫸ Commit Type: build|ci|doc|docs|feat|fix|perf|refactor|test
website|chore|style|type|revert
Inputs
tokenA GITHUB_TOKEN with the ability to pull from the repo in question. This is required. Why do we needtoken? Read more here: About the GITHUB_TOKEN secret. Default:${{ github.token }}filter-authorRegular expression filtering author. Example:filter-author: (jaywcjlove|小弟调调™|dependabot\[bot\]|Renovate Bot)filterRegular expression filtering changelog. Example:filter: '[R|r]elease[d]\s+[v|V]\d(\.\d+){0,2}'head-refThe name of the head reference. Default${{github.sha}}.base-refThe name of the second branch. Defaults to thetag_nameof the latest GitHub release. This must be a GitHub release. Git tags or branches will not work.original-markdownDefaulttrue, Output clean markdown content.gh-pagesDefaultgh-pages, Specify the branch name to get the hash frompathOnly commits containing this file path will be returned.
Outputs
changelogMarkdown formatted changelog.compareurlComparing two branches to see what’s changed or to start a new pull request.tagTag namev1.0.0.versionThe version number of the tag created. example:1.0.0branchBranch name.gh-pages-hashOutput to the latest hash of the specified branch. example:cc088c571f86fe222ff68f565gh-pages-short-hashSpecify the branch name to get the short-hash from. example:cc088c5
Troubleshooting
Error not found
Error: Not Found
If you are seeing this error its likely that you do not yet have a GitHub release. You might have a git tag and that shows up in the release tab. The API this Action uses only works with GitHub Releases. Convert one of your tags to a release and you'll be on your way. You can check out how this repository uses this action and GitHub releases for an example.
See also
- Create Tags From Auto create tags from commit or package.json.
- Github Action Contributors Github action generates dynamic image URL for contributor list to display it!
- Create Coverage Badges Create coverage badges from coverage reports. (no 3rd parties servers)
- Generated Badges Create a badge using GitHub Actions and GitHub Workflow CPU time (no 3rd parties servers)
Acknowledgements
- @conventional-changelog/conventional-changelog.
- @homeday-de/github-action-changelog-generator.
- @jessicalostinspace/commit.
- @metcalfc/changelog-generator.
Example
- uiwjs/react-md-editor
- uiwjs/react-code-preview
- uiwjs/react-amap
- uiwjs/react-heat-map
- More Examples...
Contributors
As always, thanks to our amazing contributors!
Made with action-contributors.
License
The scripts and documentation in this project are released under the MIT License