Skip to content
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
wants to merge 92 commits into from
Closed
Show file tree
Hide file tree
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 Mar 20, 2023
d1f763f
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
f7d2944
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
2ea276d
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
7364b29
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
37e3b57
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
d2379e2
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
dcfb25d
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
ae69cae
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
41099d7
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
3c722aa
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
1f46df3
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
b496db6
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
2be021b
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
169815c
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
e86d30b
Create workflow to manage changelogs
MichaelKora Mar 20, 2023
3fe2752
Update variables
MichaelKora Mar 22, 2023
a40443d
Clean code
MichaelKora Mar 22, 2023
943a953
Clean code
MichaelKora Mar 22, 2023
ba00623
Correct multi lines echos
MichaelKora Mar 22, 2023
1d036f0
Correct multi lines echos
MichaelKora Mar 22, 2023
4768ca1
Correct multi lines echos
MichaelKora Mar 22, 2023
d16d291
Correct multi lines echos
MichaelKora Mar 22, 2023
30fceb5
Correct multi lines echos
MichaelKora Mar 22, 2023
dffdf90
Clean code
MichaelKora Mar 22, 2023
0f95512
Update .github/workflows/README.md
MichaelKora Mar 22, 2023
e14dabf
Update .github/workflows/README.md
MichaelKora Mar 22, 2023
58e990b
Update .github/workflows/generate-changelog.yaml
MichaelKora Mar 22, 2023
60c09dc
Update .github/workflows/generate-changelog.yaml
MichaelKora Mar 22, 2023
f2e9281
Update .github/workflows/generate-changelog.yaml
MichaelKora Mar 22, 2023
50b0f7d
Update .github/workflows/generate-changelog.yaml
MichaelKora Mar 22, 2023
f4c9a06
Update code
MichaelKora Mar 22, 2023
16163f6
Update code
MichaelKora Mar 22, 2023
57e173e
Update code
MichaelKora Mar 22, 2023
e0d6013
Update code
MichaelKora Mar 22, 2023
2a97008
Update code
MichaelKora Mar 22, 2023
a42f7c0
Update code
MichaelKora Mar 22, 2023
072d79e
Update code
MichaelKora Mar 22, 2023
039e79c
Update code
MichaelKora Mar 24, 2023
d66fc22
Update code
MichaelKora Mar 24, 2023
b9d04a1
Update code
MichaelKora Mar 24, 2023
962ae50
Update code
MichaelKora Mar 24, 2023
5d06986
Update code
MichaelKora Mar 24, 2023
c19694b
Update code
MichaelKora Mar 24, 2023
78c6689
Update code
MichaelKora Mar 24, 2023
ef9c4e7
Update code
MichaelKora Mar 24, 2023
058b710
Update code
MichaelKora Mar 24, 2023
b1683e9
Update code
MichaelKora Mar 24, 2023
a0bc4af
Update code
MichaelKora Mar 24, 2023
3097d56
Update code
MichaelKora Mar 24, 2023
c946d57
Change workflow to composite action
MichaelKora Mar 24, 2023
61db3b7
Change workflow to composite action
MichaelKora Mar 24, 2023
9642a28
Change workflow to composite action
MichaelKora Mar 24, 2023
621c8a0
Change workflow to composite action
MichaelKora Mar 24, 2023
5c9c79d
Change workflow to composite action
MichaelKora Mar 24, 2023
47d43f3
Change workflow to composite action
MichaelKora Mar 24, 2023
ece36d2
Change workflow to composite action
MichaelKora Mar 27, 2023
bca2c2c
Update CI
MichaelKora Mar 27, 2023
80d8c6f
Update CI
MichaelKora Mar 27, 2023
c079795
Update CI
MichaelKora Mar 27, 2023
ef72116
Update CI
MichaelKora Mar 27, 2023
592cbca
Update CI
MichaelKora Mar 27, 2023
88cec7d
Revert "Run linting on the current branch instead of the default branch"
MichaelKora Mar 27, 2023
7af7af1
Update CI
MichaelKora Mar 27, 2023
b17f15b
Update Code
MichaelKora Mar 27, 2023
232139f
Use second changelog generator
MichaelKora Mar 27, 2023
ecbf982
Use second changelog generator
MichaelKora Mar 27, 2023
052d82f
Use second changelog generator
MichaelKora Mar 27, 2023
a155b67
Set sction version
MichaelKora Mar 27, 2023
09bdbbc
Update outputfile var
MichaelKora Mar 27, 2023
fa2a074
Keep header of output file
MichaelKora Mar 27, 2023
492c222
Add owner and repo
MichaelKora Mar 27, 2023
000c2ed
Fetch review details
MichaelKora Mar 27, 2023
48a585a
Remove configuration
MichaelKora Mar 29, 2023
e4ceae8
Remove configuration
MichaelKora Mar 29, 2023
6fb21b2
Remove configuration
MichaelKora Mar 29, 2023
519fd79
Remove configuration
MichaelKora Mar 29, 2023
8c6adc9
Remove configuration
MichaelKora Mar 29, 2023
b83942c
Remove configuration
MichaelKora Mar 29, 2023
8a88367
Remove configuration
MichaelKora Mar 29, 2023
791976a
Remove configuration
MichaelKora Mar 29, 2023
1ffe760
Remove configuration
MichaelKora Mar 29, 2023
fce9344
Clean code
MichaelKora Mar 29, 2023
ba4858b
Use mikepenz/release-changelog-builder-action to create and maintain …
MichaelKora Mar 29, 2023
9a12d0d
Clean code
MichaelKora Mar 29, 2023
41a6e34
Clean code
MichaelKora Mar 29, 2023
7e6aeee
Clean code
MichaelKora Mar 29, 2023
06ea1ab
Delete helm-lint.yaml
MichaelKora Mar 29, 2023
f33baf7
Clean code
MichaelKora Mar 29, 2023
9488a0f
Clean code
MichaelKora Mar 31, 2023
2415052
Use output without creating tmp file to store changelog
MichaelKora Apr 3, 2023
effdfb1
Clean code
MichaelKora Apr 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions actions/generate-changelog/README.md
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 }}"
```
58 changes: 58 additions & 0 deletions actions/generate-changelog/action.yaml
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 }}"
Copy link

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?

Copy link
Member

@yannick-roeder yannick-roeder Mar 31, 2023

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?

echo "changelog=${{ steps.build_changelog.outputs.changelog }}" >> "$GITHUB_OUTPUT"

Copy link

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

Copy link
Contributor Author

@MichaelKora MichaelKora Apr 3, 2023

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 main Changelog, 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 raw Changelog instead, then we do not need a composite action at all. because the used action already does that.

Copy link

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:

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