-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate changelog for releases #84
Closed
Closed
Changes from 90 commits
Commits
Show all changes
92 commits
Select commit
Hold shift + click to select a range
e8d982b
Create workflow to manage changelogs
MichaelKora d1f763f
Create workflow to manage changelogs
MichaelKora f7d2944
Create workflow to manage changelogs
MichaelKora 2ea276d
Create workflow to manage changelogs
MichaelKora 7364b29
Create workflow to manage changelogs
MichaelKora 37e3b57
Create workflow to manage changelogs
MichaelKora d2379e2
Create workflow to manage changelogs
MichaelKora dcfb25d
Create workflow to manage changelogs
MichaelKora ae69cae
Create workflow to manage changelogs
MichaelKora 41099d7
Create workflow to manage changelogs
MichaelKora 3c722aa
Create workflow to manage changelogs
MichaelKora 1f46df3
Create workflow to manage changelogs
MichaelKora b496db6
Create workflow to manage changelogs
MichaelKora 2be021b
Create workflow to manage changelogs
MichaelKora 169815c
Create workflow to manage changelogs
MichaelKora e86d30b
Create workflow to manage changelogs
MichaelKora 3fe2752
Update variables
MichaelKora a40443d
Clean code
MichaelKora 943a953
Clean code
MichaelKora ba00623
Correct multi lines echos
MichaelKora 1d036f0
Correct multi lines echos
MichaelKora 4768ca1
Correct multi lines echos
MichaelKora d16d291
Correct multi lines echos
MichaelKora 30fceb5
Correct multi lines echos
MichaelKora dffdf90
Clean code
MichaelKora 0f95512
Update .github/workflows/README.md
MichaelKora e14dabf
Update .github/workflows/README.md
MichaelKora 58e990b
Update .github/workflows/generate-changelog.yaml
MichaelKora 60c09dc
Update .github/workflows/generate-changelog.yaml
MichaelKora f2e9281
Update .github/workflows/generate-changelog.yaml
MichaelKora 50b0f7d
Update .github/workflows/generate-changelog.yaml
MichaelKora f4c9a06
Update code
MichaelKora 16163f6
Update code
MichaelKora 57e173e
Update code
MichaelKora e0d6013
Update code
MichaelKora 2a97008
Update code
MichaelKora a42f7c0
Update code
MichaelKora 072d79e
Update code
MichaelKora 039e79c
Update code
MichaelKora d66fc22
Update code
MichaelKora b9d04a1
Update code
MichaelKora 962ae50
Update code
MichaelKora 5d06986
Update code
MichaelKora c19694b
Update code
MichaelKora 78c6689
Update code
MichaelKora ef9c4e7
Update code
MichaelKora 058b710
Update code
MichaelKora b1683e9
Update code
MichaelKora a0bc4af
Update code
MichaelKora 3097d56
Update code
MichaelKora c946d57
Change workflow to composite action
MichaelKora 61db3b7
Change workflow to composite action
MichaelKora 9642a28
Change workflow to composite action
MichaelKora 621c8a0
Change workflow to composite action
MichaelKora 5c9c79d
Change workflow to composite action
MichaelKora 47d43f3
Change workflow to composite action
MichaelKora ece36d2
Change workflow to composite action
MichaelKora bca2c2c
Update CI
MichaelKora 80d8c6f
Update CI
MichaelKora c079795
Update CI
MichaelKora ef72116
Update CI
MichaelKora 592cbca
Update CI
MichaelKora 88cec7d
Revert "Run linting on the current branch instead of the default branch"
MichaelKora 7af7af1
Update CI
MichaelKora b17f15b
Update Code
MichaelKora 232139f
Use second changelog generator
MichaelKora ecbf982
Use second changelog generator
MichaelKora 052d82f
Use second changelog generator
MichaelKora a155b67
Set sction version
MichaelKora 09bdbbc
Update outputfile var
MichaelKora fa2a074
Keep header of output file
MichaelKora 492c222
Add owner and repo
MichaelKora 000c2ed
Fetch review details
MichaelKora 48a585a
Remove configuration
MichaelKora e4ceae8
Remove configuration
MichaelKora 6fb21b2
Remove configuration
MichaelKora 519fd79
Remove configuration
MichaelKora 8c6adc9
Remove configuration
MichaelKora b83942c
Remove configuration
MichaelKora 8a88367
Remove configuration
MichaelKora 791976a
Remove configuration
MichaelKora 1ffe760
Remove configuration
MichaelKora fce9344
Clean code
MichaelKora ba4858b
Use mikepenz/release-changelog-builder-action to create and maintain …
MichaelKora 9a12d0d
Clean code
MichaelKora 41a6e34
Clean code
MichaelKora 7e6aeee
Clean code
MichaelKora 06ea1ab
Delete helm-lint.yaml
MichaelKora f33baf7
Clean code
MichaelKora 9488a0f
Clean code
MichaelKora 2415052
Use output without creating tmp file to store changelog
MichaelKora effdfb1
Clean code
MichaelKora File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Generate Changelog | ||
|
||
This action will allow for the automatic generation of a changelog. The changelog template needs to be configured using a `changelog-config.json`. This action will then create a changelog for the new release and update the changelog file in your repository. | ||
|
||
## Dependencies | ||
|
||
This action is built from the following composite actions: | ||
|
||
- [release-changelog-builder-action](https://github.com/mikepenz/release-changelog-builder-action) | ||
|
||
## Prerequisites | ||
|
||
Create a file called `changelog-config.json` that contains the changelog configurations. The mentioned action's documentation goes into great detail about how to create and utilize config files. A simple configuration may look like this: | ||
|
||
```yaml | ||
{ | ||
"categories": | ||
[ | ||
{ "title": "## 🚀 Features", "labels": ["feature", "feat"] }, | ||
{ "title": "## 🐛 Fixes", "labels": ["fix", "bug"] }, | ||
{ "title": "## 🧪 Dependencies", "labels": ["dependency"] }, | ||
], | ||
"ignore_labels": ["ignore"], | ||
"sort": { "order": "ASC", "on_property": "mergedAt" }, | ||
"template": "# [${{TO_TAG}}](https://github.com/<myorganization>/<myrepository>/releases/tag/${{TO_TAG}}) - ${{TO_TAG_DATE}}\n\n${{CHANGELOG}}\n<details>\n<summary>Uncategorized</summary>\n\n${{UNCATEGORIZED}}\n</details>\n", | ||
"pr_template": "- ${{TITLE}}\n - PR: ${{URL}}\n - Assignees: ${{ASSIGNEES[*]}}\n - Reviewers: ${{REVIEWERS[*]}}\n - Approvers: ${{APPROVERS[*]}}", | ||
"empty_template": "- no changes!", | ||
} | ||
``` | ||
|
||
Make sure to update the link `https://github.com/<myorganization>/<myrepository>/releases/tag/${{TO_TAG}}` accordingly. | ||
|
||
Additional configuration options can be explored [here](https://github.com/mikepenz/release-changelog-builder-action#configuration-specification). | ||
|
||
## Input Parameters | ||
|
||
| Name | Required | Default Value | Description | | ||
| ----------------------- | :------: | :-------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | | ||
| changelog-file | ✅ | - | Path to the Changelog.md file | | ||
| github-token | ✅ | - | The GitHub token for committing the changes | | ||
| new-tag | ✅ | - | New version | | ||
| old-tag | ✅ | - | Previous version | | ||
| config | ❌ | "./.github/changelog-config.json" | Path to the changelog config JSON file | | ||
| output | ❌ | "changes.md" | Relative path to a file to store the resulting changelog in. | | ||
| fetchReviewers | ❌ | "false" | Will enable fetching the users/reviewers who approved the PR. | | ||
| fetchReleaseInformation | ❌ | "false" | Will enable fetching additional release information from tags. | | ||
| commitMode | ❌ | "false" | Special configuration for projects which work without PRs. Uses commit messages as changelog. This mode looses access to information only available for PRs. | | ||
|
||
## Calling the workflow | ||
|
||
```yaml | ||
steps: | ||
# check out current repository | ||
- uses: actions/checkout@v3 | ||
# generate changelog | ||
- name: Create changelog | ||
uses: bakdata/ci-templates/actions/generate-changelog@main | ||
with: | ||
old-tag: "1.0.0" | ||
new-tag: "1.0.1" | ||
gh-changelog: "CHANGELOG.md" | ||
doc-changelog: "./docs/Changelog.md" | ||
config: "./.github/changelog-config.json" | ||
github-email: "${{ secrets.GH_EMAIL }}" | ||
github-username: "${{ secrets.GH_USERNAME }}" | ||
github-token: "${{ secrets.GH_TOKEN }}" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: "Generate changelog" | ||
description: "Generate changelog after release" | ||
inputs: | ||
# required inputs | ||
changelog-file: | ||
description: Path to the Changelog.md file | ||
required: true | ||
github-token: | ||
description: "The GitHub token for committing the changes." | ||
required: true | ||
new-tag: | ||
description: Version after bump | ||
required: true | ||
old-tag: | ||
description: Previous version | ||
required: true | ||
# unrequired inputs | ||
config: | ||
description: Path to the changelog config JSON file | ||
required: false | ||
default: "./.github/changelog-config.json" | ||
output: | ||
description: "Name of the output file for the generate changelog step" | ||
required: false | ||
default: "changes.md" | ||
fetchReviewers: | ||
description: "Will enable fetching the users/reviewers who approved the PR" | ||
required: false | ||
default: "false" | ||
fetchReleaseInformation: | ||
description: "Will enable fetching additional release information from tags." | ||
required: false | ||
default: "false" | ||
commitMode: | ||
description: "Special configuration for projects which work without PRs." | ||
required: false | ||
default: "false" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: "Create changelog" | ||
id: build_changelog | ||
uses: mikepenz/[email protected] | ||
with: | ||
token: "${{ inputs.github-token }}" | ||
configuration: "${{ inputs.config }}" | ||
fromTag: "${{ inputs.old-tag }}" | ||
toTag: "${{ inputs.new-tag }}" | ||
outputFile: "${{ inputs.output }}" | ||
fetchReviewers: "${{ inputs.fetchReviewers }}" | ||
fetchReleaseInformation: "${{ inputs.fetchReleaseInformation }}" | ||
commitMode: "${{ inputs.commitMode }}" | ||
- name: Update github Changelog | ||
torbsto marked this conversation as resolved.
Show resolved
Hide resolved
|
||
run: | | ||
# Reformat changes.md and add it to the existing changelog | ||
sed -i 's/# /## /g' ${{ inputs.output }} | ||
sed -i '/# Changelog/ r ${{ inputs.output }}' ${{ inputs.gh-changelog }} | ||
shell: bash |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like this action has a number of output, among others
outputs.changelog
. Can we also use an output instead of writing it to a temporary file?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you mean something like this then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the temporary file was only a workaround. I think using the output is much cleaner because we have one less parameter and users don't need to worry that we add a file that they might accidentally commit and push
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@torbsto @yannick-roeder @raminqaf
in order to modify this the generate
Changelog
before adding it to the mainChangelog
, we need to store it in a tmp file.However, if we do not wish to change the
Changelog
file in this composite action and want to return the rawChangelog
instead, then we do not need a composite action at all. because the used action already does that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MichaelKora @yannick-roeder Just to clarify, I do want to update the changelog file, but I also need the generated changelog for the GitHub release later on, for example in Quick: