A Github Action to generate CHANGELOG automatically according to conventional commits.
Feel free to submit a pull request or an issue, but make sure to follow the templates.
Welcome contributors to improve this project together!
If you like this, please give me a star!
Create a workflow file such as .github/workflows/changelog.yml
(you can find it in this repo)
name: Generate changelog
on:
release:
types: [created, edited]
jobs:
generate-changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: BobAnkh/auto-generate-changelog@master
with:
REPO_NAME: '<YourUserName>/<YourRepoName>'
ACCESS_TOKEN: ${{secrets.GITHUB_TOKEN}}
PATH: 'CHANGELOG.md'
COMMIT_MESSAGE: 'docs(CHANGELOG): update release notes'
TYPE: 'feat:Feature,fix:Bug Fixes,docs:Documentation,refactor:Refactor,perf:Performance Improvements'
NOTE: Generating CHANGELOG needs all the commit history so you should set
fetch-depth: 0
withactions/checkout
NOTE: commit log begins with
docs(changelog)
ordoc(CHANGELOG)
will not be added to the CHANGELOG
Please see notes below the table for more optional features.
Inputs | Description | Required | Default |
---|---|---|---|
REPO_NAME | Repository name | no | '' which means current repository |
ACCESS_TOKEN | Github Access Token | yes | You can just pass ${{secrets.GITHUB_TOKEN}} |
PATH | Path to the your file | no | /CHANGELOG.md |
BRANCH | The branch to update file specified in PATH | no | '' which means default branch |
PULL_REQUEST | Open a new pull request if set to a target branch name | no | '' which means not open pull request by default |
COMMIT_MESSAGE | commit message | no | docs(CHANGELOG): update release notes |
TYPE | The type of commits you want to add to CHANGELOG | no | 'feat:Feature,fix:Fix' |
COMMITTER | The committer you want to use to update file | no | '' which means default committer |
DEFAULT_SCOPE | The default scope to hold all unscoped commits | no | general |
SUPPRESS_UNSCOPED | Whether to exclude unscoped commits | no | false |
${{secrets.GITHUB_TOKEN}}
has a rate limit smaller than Personal Access Token, so if you have much more requests(commits, prs, etc.), use PAT instead.
COMMITTER
should be in the format:'author <author.example>'
NOTE:
PULL_REQUEST
must be used withBRANCH
together, both should be provided if you want to open a pull requestYou can define the keyword detected from commit message and the corresonding word presented in the changelog in input
TYPE
. For example, definefeat:Feature
will detect commit message likefeat(main): add new option
and present this in changelog as partFeature
NOTE: You can use format below to avoid some lines in release description to appear in CHANGELOG:
<!-- HIDE IN CHANGELOG BEGIN --> See CHANGELOG for more details. <!-- HIDE IN CHANGELOG END -->
You should follow our Code of Conduct.
See CONTRIBUTING GUIDELINES for contributing conventions.
Make sure to pass all the tests before submitting your code. You can conduct pytest -ra
at the root directory to run all tests.
You can use local mode when develope it on your local machine, here is the command-line help info:
usage: main.py [-h] [-m MODE] [-f FILE] [-o OUTPUT] [-t TOKEN]
optional arguments:
-h, --help show this help message and exit
-m MODE, --mode MODE choose to use local-dev mode or on github action mode.
Valid values are 'local' or 'github'
-f FILE, --file FILE configuration file to read from when running local-dev
mode
-o OUTPUT, --output OUTPUT
output file when running local-dev mode
-t TOKEN, --token TOKEN
Github Access Token
Yixin Shen |
Sebastian Rühl |
Apache-2.0 © BobAnkh