- Notifications
You must be signed in to change notification settings - Fork32
GitHub Action to generate changelogs, release notes, whatever
License
metcalfc/changelog-generator
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This Action returns a markdown formatted changelog between two git references. There are other projects that use milestones, labeled PRs, etc. Those are just too much work for simple projects.
I just wanted a simple way to populate the body of a GitHub Release.
A GITHUB_TOKEN with the ability to pull from the repo in question. This is required.
Why do we needmyToken? Read more here:https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token#about-the-github_token-secret
The name of the head reference. Default${{github.sha}}.
The name of the second branch. Defaults to thetag_name of the latest GitHub release.This must be a GitHub release. Git tags or branches will not work.
Whether the order of commits should be printed in reverse. Default: 'false'
Whether this action should pull in all other branches and tags. Default: 'true'
Markdown formatted changelog.
There are two blocks you will need:
First you will need to generate the changelog itself. To get the changelog between the SHA of the commit that triggered the action and the tag of the latest release:
-name:Generate changelogid:changeloguses:metcalfc/changelog-generator@v4.6.2with:myToken:${{ secrets.GITHUB_TOKEN }}
Or, if you have two specific references you want:
-name:Generate changelogid:changeloguses:metcalfc/changelog-generator@v4.6.2with:myToken:${{ secrets.GITHUB_TOKEN }}head-ref:'v0.0.2'base-ref:'v0.0.1'
If you want to point to a branch containing forward slashes (#179) do the following:
# let the checkout action do the fetching-uses:actions/checkout@v3with:fetch-depth:0-name:Generate changelogid:changeloguses:metcalfc/changelog-generator@v4.6.2#TODO: bump this after releasewith:myToken:${{ secrets.GITHUB_TOKEN }}head-ref:'origin/my/branch/with/slashes'#add 'origin/` in front of your branch namebase-ref:'v4.6.2'fetch:false
Then you can use the resulting changelog:
-name:Get the changelogrun:| cat << "EOF" ${{ steps.changelog.outputs.changelog }} EOF
Some folks have asked if the action can support changing the output. For example:
- Reverse orderUPDATE as of 2021/11/22 chronological is the default and it can be reversed by setting
reverse: 'true'in the workflow. - Ignore entries that include this string.
- Etc
In order to keep this action as simple as possible we aren't planning to add more flags or options. However since the output is just text you can write a command line to do anything you want. In issue #93 we had a user that wanted to list the changelog in reverse order and drop any entries withgh-pages. Here is how they can do that but using Bumping as the restrict word because it shows up in this projects history:
-name:Modify the changelogid:modifiedrun:| set -o noglob log=$(cat << "EOF" | grep -v Bumping | tac ${{ steps.changelog.outputs.changelog }} EOF ) log="${log//'%'/'%25'}" log="${log//$'\n'/'%0A'}" log="${log//$'\r'/'%0D'}" echo "log=$log" >> $GITHUB_OUTPUT -name:Print the modified changelogrun:| cat << "EOF" ${{ steps.modified.outputs.log }} EOF
You might be wondering about that set of escaping for thelog. Thats because GitHub Actions doesn't support multiline output. Read morehere.
Generating the release notes for a GitHub Release.
Issues are for folks who are actively using the action and running into an "issue" (bug, missing doc, etc).
Feature requests should be in thediscussion section..Just to set expectations the bar for a new feature getting added is going to be very high. There is acost to adding features in the development and maintainance of the feature. So if you want to jump in andhelp develop and maintain lets discuss. If you want to fire off feature ideas, go for it. Just understand itsvery likely that without someone willing to take up the task, they won't get implemented.
SinceDependabothasnative GitHub Actions support,to enable it on your GitHub repo all you need to do is add the.github/dependabot.yml file:
version:2updates:# Maintain dependencies for GitHub Actions -package-ecosystem:'github-actions'directory:'/'schedule:interval:'daily'
Error: Not FoundIf 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. TheAPI 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 thisrepository uses this action and GitHub releases for anexample.
I took the basic framework for this action from:jessicalostinspace/commit-difference-action. Thanks @jessicalostinspace.
About
GitHub Action to generate changelogs, release notes, whatever
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors8
Uh oh!
There was an error while loading.Please reload this page.
