Skip to content

Commit

Permalink
Update change log builder action to v4 (#117)
Browse files Browse the repository at this point in the history
* Update change log builder action to v4

---------

Co-authored-by: Alejandro Jaramillo <[email protected]>
  • Loading branch information
raminqaf and irux authored Jun 26, 2023
1 parent ed6217c commit 48341d8
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 16 deletions.
60 changes: 45 additions & 15 deletions actions/changelog-generate/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
# Generate Changelog

This action will enable the automated creation of a changelog. The changelog template needs to be configured using a `changelog-config.json`.
This action will enable the automated creation of a changelog.
The changelog template needs to be configured using a `changelog-config.json`.
If there is a global changelog managed by the repository this will be updated.
The action generates a new release changelog and an updated version of the changelog file in the repository (if there is any). The default setting updates the repo changelog. If your current repository does not have any global changelog file, then pass an empty string to the variable `changelog-file`.
The action generates a new release changelog and an updated version of
the changelog file in the repository (if there is any).
The default setting updates the repo changelog.
If your current repository does not have any global changelog file,
then pass an empty string to the variable `changelog-file`.
The action returns both the new tag's changelog and the global changelog.

When generating the changelog, the action evaluates two factors to decide which PRs to consider: `old-tag` (lower bound defining the 'start' from where the changelog will consider merged pull requests) and `new-tag` (upper bound defining until which tag the changelog will consider merged pull requests).
When generating the changelog, the action evaluates two factors to decide which PRs to consider:
`old-tag`
(lower bound defining the 'start' from where the changelog will consider merged pull requests)
and `new-tag`
(upper bound defining until which tag the changelog will consider merged pull requests).

The upper bound might be either existing or new. If the new tag does not yet exist, the action will nevertheless create the changelog so that it may be included in the release.
The upper bound might be either existing or new.
If the new tag does not yet exist, the action will
nevertheless create the changelog so that it may be included in the release.

## Dependencies

Expand All @@ -17,7 +28,9 @@ This action is built from the following composite actions:

## 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:
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:

```json
{
Expand All @@ -26,33 +39,47 @@ Create a file called `changelog-config.json` that contains the changelog configu
"title": "## 🚀 Features",
"labels": ["feature", "feat", "enhancement"]
},
{ "title": "## 🐛 Fixes", "labels": ["fix", "bug"] },
{ "title": "## 🧪 Dependencies", "labels": ["dependency"] }
{
"title": "## 🐛 Fixes",
"labels": ["fix", "bug"]
},
{
"title": "## 🧪 Dependencies",
"labels": ["dependency"]
},
{
"title": "## 📦 Uncategorized",
"labels": []
}
],
"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}}\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[*]}}",
"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}}",
"empty_template": "- no changes!"
}
```

Make sure to update the link `https://github.com/<myorganization>/<myrepository>/releases/tag/${{TO_TAG}}` accordingly and make sure to include `- Release Date: ${{TO_TAG_DATE}}` because the action looks for this pattern to make the date format easily readable.
Make sure to update the link
`https://github.com/<myorganization>/<myrepository>/releases/tag/${{TO_TAG}}`
accordingly and make sure to include `- Release Date: ${{TO_TAG_DATE}}`
because the action looks for this pattern to make the date format easily readable.

Additional configuration options can be explored [here](https://github.com/mikepenz/release-changelog-builder-action#configuration-specification).
Additional configuration options can be explored
[here](https://github.com/mikepenz/release-changelog-builder-action#configuration-specification).

## Input Parameters

| Name | Required | Default Value | Description |
| ------------------------- | :------: | :-------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| github-token || - | The GitHub token for committing the changes |
| new-tag || - | New version |
| 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 || "" | Previous version |
| 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 @@ -63,7 +90,10 @@ Additional configuration options can be explored [here](https://github.com/mikep

## Calling the workflow

By default, just a single commit for the ref/SHA that started the process is retrieved. In the [checkout action](https://github.com/actions/checkout), enter `fetch-depth: 0` to retrieve all history for all branches and tags. Without it, the changelog action will be unable to track down previous tags.
By default, just a single commit for the ref/SHA that started the process is retrieved.
In the [checkout action](https://github.com/actions/checkout), enter `fetch-depth: 0` to retrieve
all history for all branches and tags.
Without it, the changelog action will be unable to track down previous tags.

```yaml
steps:
Expand All @@ -75,7 +105,7 @@ steps:
id: build_changelog
uses: bakdata/ci-templates/actions/changelog-generate@main
with:
token: ${{ secrets.GH_TOKEN }}
github-token: ${{ secrets.GH_TOKEN }}
config: "./.github/changelog-config.json"
new-tag: "1.0.0"
changelog-file: "CHANGELOG.md"
Expand Down
2 changes: 1 addition & 1 deletion actions/changelog-generate/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ runs:

- name: "Create changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v3.7.0
uses: mikepenz/release-changelog-builder-action@v4
with:
token: "${{ inputs.github-token }}"
configuration: "${{ inputs.config }}"
Expand Down

0 comments on commit 48341d8

Please sign in to comment.