Skip to content

Commit

Permalink
Update changelog template and introduce codeowners to notify when a P…
Browse files Browse the repository at this point in the history
…R is created (#141)
  • Loading branch information
MichaelKora authored Sep 21, 2023
1 parent f35abcd commit 825cfce
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 45 deletions.
11 changes: 0 additions & 11 deletions .github/changelog-config.json

This file was deleted.

1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @yannick-roeder @MichaelKora @yordanovsstoyan
44 changes: 13 additions & 31 deletions actions/changelog-generate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,11 @@ files. A simple configuration may look like this:

```json
{
"categories": [
{
"title": "## 🚀 Features",
"labels": ["feature", "feat", "enhancement"]
},
{
"title": "## 🐛 Fixes",
"labels": ["fix", "bug"]
},
{
"title": "## 🧪 Dependencies",
"labels": ["dependency"]
},
{
"title": "## 📦 Uncategorized",
"labels": []
}
],
"categories": [{ "title": "### Merged pull requests:" }],
"ignore_labels": ["ignore"],
"sort": { "order": "ASC", "on_property": "mergedAt" },
"template": "# [${{TO_TAG}}](https://github.com/<myorganization>/<myrepository>/releases/tag/${{TO_TAG}}) - Release Date: ${{TO_TAG_DATE}}\n\n${{CHANGELOG}}",
"pr_template": "- ${{TITLE}}\n - PR: ${{URL}}\n - Assignees: ${{ASSIGNEES}}\n - Reviewers: ${{REVIEWERS}}\n - Approvers: ${{APPROVERS}}",
"template": "# [#{{TO_TAG}}](https://github.com/#{{OWNER}}/#{{REPO}}/releases/tag/#{{TO_TAG}}) - Release Date: #{{TO_TAG_DATE}}\n\n#{{CHANGELOG}}",
"pr_template": "- #{{TITLE}} [##{{NUMBER}}](#{{URL}}) ([@#{{AUTHOR}}](https://github.com/#{{AUTHOR}}))\n",
"empty_template": "- no changes!"
}
```
Expand All @@ -70,16 +53,16 @@ Additional configuration options can be explored

## Input Parameters

| Name | Required | Default Value | Description |
| ------------------------- | :------: | :-------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| github-token || - | The GitHub token for committing the changes |
| new-tag || - | Defines until which tag the changelog will consider merged pull requests (can be a tag or a valid git ref) |
| changelog-file || "CHANGELOG.md" | Path to the Changelog.md file |
| commit-mode || "false" | Special configuration for projects which work without PRs. Uses commit messages as changelog. This mode looses access to information only available for PRs. |
| config || "./.github/changelog-config.json" | Path to the changelog config JSON file |
| fetch-release-information || "false" | Will enable fetching additional release information from tags. |
| fetch-reviewers || "false" | Will enable fetching the users/reviewers who approved the PR. |
| old-tag || "" | Defines the 'start' from where the changelog will consider merged pull requests (can be a tag or a valid git ref) |
| Name | Required | Default Value | Description |
| ------------------------- | :------: | :-----------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| github-token || - | The GitHub token for committing the changes |
| new-tag || - | Defines until which tag the changelog will consider merged pull requests (can be a tag or a valid git ref) |
| changelog-file || "CHANGELOG.md" | Path to the Changelog.md file |
| commit-mode || "false" | Special configuration for projects which work without PRs. Uses commit messages as changelog. This mode looses access to information only available for PRs. |
| config || "$GITHUB_ACTION_PATH/changelog-config.json" | Path to the changelog config JSON file |
| fetch-release-information || "false" | Will enable fetching additional release information from tags. |
| fetch-reviewers || "false" | Will enable fetching the users/reviewers who approved the PR. |
| old-tag || "" | Defines the 'start' from where the changelog will consider merged pull requests (can be a tag or a valid git ref) |

## Outputs

Expand All @@ -106,7 +89,6 @@ steps:
uses: bakdata/ci-templates/actions/changelog-generate@main
with:
github-token: ${{ secrets.GH_TOKEN }}
config: "./.github/changelog-config.json"
new-tag: "1.0.0"
changelog-file: "CHANGELOG.md"
fetch-reviewers: "true"
Expand Down
9 changes: 6 additions & 3 deletions actions/changelog-generate/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ inputs:
config:
description: Path to the changelog config JSON file
required: false
default: "./.github/changelog-config.json"
default: "$GITHUB_ACTION_PATH/changelog-config.json"
fetch-release-information:
description: "Will enable fetching additional release information from tags."
required: false
Expand All @@ -43,6 +43,7 @@ outputs:
value: ${{ steps.output-generator.outputs.single-changelog }}
runs:
using: "composite"

steps:
- name: "Set tags"
id: set-tags
Expand Down Expand Up @@ -73,14 +74,16 @@ runs:
fi
fi
echo "fromtag=$setfrom">> $GITHUB_OUTPUT
# when using inputs.config directly it does not work and remapping it makes it work
echo "path=${{ inputs.config }}" >> "$GITHUB_OUTPUT"
shell: bash

- name: "Create changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
token: "${{ inputs.github-token }}"
configuration: "${{ inputs.config }}"
configuration: "${{ steps.set-tags.outputs.path }}"
fromTag: "${{ steps.set-tags.outputs.fromtag }}"
toTag: "${{ steps.set-tags.outputs.totag }}"
outputFile: ${{ runner.temp }}/changes.md
Expand Down Expand Up @@ -111,7 +114,7 @@ runs:
# Create changelog.md in case of a first Release
if [ -n "${{ inputs.changelog-file }}" ]; then
sed -i 's/# /## /g' ${{ runner.temp }}/changes.md
echo -e "\n" >> ${{ runner.temp }}/changes.md
echo -e "\n" >> ${{ runner.temp }}/changes.md
if [ ! -f "${{ inputs.changelog-file }}" ]; then
echo $'# Changelog\n' >> ${{ inputs.changelog-file }}
fi
Expand Down
8 changes: 8 additions & 0 deletions actions/changelog-generate/changelog-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"categories": [{ "title": "### Merged pull requests:" }],
"ignore_labels": ["ignore"],
"sort": { "order": "ASC", "on_property": "mergedAt" },
"template": "# [#{{TO_TAG}}](https://github.com/#{{OWNER}}/#{{REPO}}/releases/tag/#{{TO_TAG}}) - Release Date: #{{TO_TAG_DATE}}\n\n#{{CHANGELOG}}",
"pr_template": "- #{{TITLE}} [##{{NUMBER}}](#{{URL}}) ([@#{{AUTHOR}}](https://github.com/#{{AUTHOR}}))\n",
"empty_template": "- no changes!"
}

0 comments on commit 825cfce

Please sign in to comment.