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

Feat: New changelog generator #205

Merged
merged 11 commits into from
Nov 5, 2024
Merged

Conversation

DerTiedemann
Copy link
Contributor

@DerTiedemann DerTiedemann commented Jul 4, 2024

New changelog generator: https://git-cliff.org/
This action updated replaces the previous generator with the aforementioned tool.

All existing functionality has been preserved and some new things have been added, most notably the first contribution mention. The action will check of there is a cliff.toml present in the current repo and if not use the default that is present inside of this repo. Custom configs are sometimes required to filter out commits that dont contain meaningful changes like version bumps. An example of how this could look for streams-bootstrap:

# ommited
commit_parsers = [
  { message = "^\\[Gradle Release Plugin\\]", skip = true },
  { message = "^Changelog for version .*", skip = true },
]

Which turns changelogs that look like this:

2.23.0 - 2024-06-12

What's changed

  • [Gradle Release Plugin] - new version commit: '2.22.2-SNAPSHOT'. by @bakdata-bot

  • Changelog for version 2.22.1 by @bakdata-bot

  • Add dynamic application.server config to streams app chart by @philipp94831 in #214

  • [Gradle Release Plugin] - pre tag commit: '2.23.0'. by @bakdata-bot

Full Changelog: bakdata/streams-bootstrap@2.22.1...2.23.0

into this:

2.23.0 - 2024-06-12

What's changed

  • Add dynamic application.server config to streams app chart by @philipp94831 in #214

Full Changelog: bakdata/streams-bootstrap@2.22.1...2.23.0


For more config options have a look at the docs, this thing is pretty powerful. Let me know what you think.

@DerTiedemann DerTiedemann force-pushed the tiedemann/changelog-action branch from 29b4fa8 to ff2a6fe Compare July 11, 2024 11:51
@DerTiedemann DerTiedemann marked this pull request as ready for review July 11, 2024 12:00
@DerTiedemann
Copy link
Contributor Author

I was asked if this can also group by labels, a little tricky but its possible with this config:

# git-cliff ~ default configuration file
# https://git-cliff.org/docs/configuration
#
# Lines starting with "#" are comments.
# Configuration options are organized into tables and keys.
# See documentation for more information on available options.

[changelog]
# template for the changelog footer
header = """
# Changelog\n
All notable changes to this project will be documented in this file.\n
"""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{%- macro remote_url() -%}\
  https://github.com/{{ remote.github.owner }}/{{ remote.github.repo }}
{%- endmacro -%}
{%- if version -%}
    ## [{{ version | trim_start_matches(pat="v") }}]({{ self::remote_url() }}/tree/{{ version | trim_start_matches(pat="v")}}) - {{ timestamp | date(format="%Y-%m-%d") }}
{%- else -%}
    ## [unreleased]
{%- endif %}
### What's changed
{% for _groups, commits in commits | group_by(attribute="github.pr_labels") %}

  {%- set groups = _groups | trim_start_matches(pat="[") | trim_end_matches(pat="]") | trim | split(pat=",") -%}
  {%- set_global labels = [] -%}
  {%- for group in groups -%}
    {% set_global label = group | trim_start_matches(pat='"') | trim_end_matches(pat='"') %}
    {% if label == "" %}{% set label = "Uncategorized" %}{% endif %}
    {% set_global labels = labels | concat(with=label) %}
  {%- endfor -%}

  {%- if labels | length > 0 %}
    #### {{ labels | join(sep=" & ") }}
      {% for commit in commits %}
        {% if commit.github.pr_title -%}\
          {%- set commit_message = commit.github.pr_title -%}
        {%- else -%}
          {%- set commit_message = commit.message -%}
        {%- endif -%}
        * {{ commit_message | split(pat="\n") | first | trim }}\
          {% if commit.github.username %} by @{{ commit.github.username }}{%- endif -%}
          {% if commit.github.pr_number %} in \
            [#{{ commit.github.pr_number }}]({{ self::remote_url() }}/pull/{{ commit.github.pr_number }}) \
          {%- endif %}    
    {%- endfor -%}
  {%- endif -%}
{% endfor %}\n
{%- if github -%}
{% if github.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
  {% raw %}\n{% endraw -%}
  ### New Contributors
{%- endif %}\
{% for contributor in github.contributors | filter(attribute="is_first_time", value=true) %}
  * @{{ contributor.username }} made their first contribution
    {%- if contributor.pr_number %} in \
      [#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull/{{ contributor.pr_number }}) \
    {%- endif %}
{%- endfor -%}
{%- endif -%}

{% if version %}
    {% if previous.version %}
      **Full Changelog**: {{ self::remote_url() }}/compare/{{ previous.version }}...{{ version }}
    {% endif %}
{% endif %}
"""
# template for the changelog footer
footer = """
<!-- generated by git-cliff -->
"""
# remove the leading and trailing s
trim = true
# postprocessors
postprocessors = [
  # { pattern = '<REPO>', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL
]

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# filter out the commits that are not conventional
filter_unconventional = false
# process each line of a commit as an individual commit
split_commits = false
# regex for preprocessing the commit messages
commit_preprocessors = [
  # Replace issue numbers
  #{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](<REPO>/issues/${2}))"},
  # Check spelling of the commit with https://github.com/crate-ci/typos
  # If the spelling is incorrect, it will be automatically fixed.
  #{ pattern = '.*', replace_command = 'typos --write-changes -' },
]
commit_parsers = [{ message = "^Bump version", skip = true }]
# regex for parsing and grouping commits
# protect breaking changes from being skipped due to matching a skipping commit_parser
protect_breaking_commits = false
# filter out the commits that are not matched by commit parsers
filter_commits = false
# regex for matching git tags
# tag_pattern = "v[0-9].*"
# regex for skipping tags
# skip_tags = ""
# regex for ignoring tags
# ignore_tags = ""
# sort the tags topologically
topo_order = false
# sort the commits inside sections by oldest/newest order
sort_commits = "oldest"
# limit the number of commits included in the changelog.
# limit_commits = 42

which produces changelogs like this for kpops:

Changelog

All notable changes to this project will be documented in this file.

6.1.0 - 2024-07-09

What's changed

type/enhancement & component/handlers

type/enhancement & component/pipeline-components

  • Add image tag field to streams-bootstrap app values by @raminqaf in #499

type/refactor

Full Changelog: bakdata/kpops@6.0.2...6.1.0

6.0.2 - 2024-07-04

What's changed

area/documentation

Uncategorized

Full Changelog: bakdata/kpops@6.0.1...6.0.2

6.0.1 - 2024-06-12

What's changed

type/bug & component/pipeline-components

Full Changelog: bakdata/kpops@6.0.0...6.0.1

6.0.0 - 2024-06-06

What's changed

type/enhancement & type/refactor & component/cli & breaking-change

Full Changelog: bakdata/kpops@5.1.1...6.0.0

5.1.1 - 2024-05-22

What's changed

type/bug

Full Changelog: bakdata/kpops@5.1.0...5.1.1

5.1.0 - 2024-05-22

What's changed

component/pipeline-components

  • Add computed field for Helm release name and name override by @disrupted in #490

Full Changelog: bakdata/kpops@5.0.1...5.1.0

@DerTiedemann DerTiedemann force-pushed the tiedemann/changelog-action branch from 1a1584e to 3356d89 Compare August 5, 2024 22:34
yannick-roeder
yannick-roeder previously approved these changes Oct 22, 2024
@DerTiedemann DerTiedemann force-pushed the tiedemann/changelog-action branch from 1cb5c8e to 1716df2 Compare October 28, 2024 07:50
@DerTiedemann DerTiedemann force-pushed the tiedemann/changelog-action branch from 0f65e3c to 7384ed4 Compare October 28, 2024 09:23
@DerTiedemann DerTiedemann merged commit 4109308 into main Nov 5, 2024
6 checks passed
@DerTiedemann DerTiedemann deleted the tiedemann/changelog-action branch November 5, 2024 08:18
DerTiedemann added a commit that referenced this pull request Nov 13, 2024
New changelog generator: https://git-cliff.org/
This action updated replaces the previous generator with the
aforementioned tool.

All existing functionality has been preserved and some new things have
been added, most notably the first contribution mention. The action will
check of there is a `cliff.toml` present in the current repo and if not
use the default that is present inside of this repo. Custom configs are
sometimes required to filter out commits that dont contain meaningful
changes like version bumps. An example of how this could look for
streams-bootstrap:
```toml
commit_parsers = [
  { message = "^\\[Gradle Release Plugin\\]", skip = true },
  { message = "^Changelog for version .*", skip = true },
]
```

Which turns changelogs that look like this:
2024-06-12

* [Gradle Release Plugin] - new version commit: '2.22.2-SNAPSHOT'. by
@bakdata-bot

* Changelog for version 2.22.1 by @bakdata-bot

* Add dynamic application.server config to streams app chart by
@philipp94831 in
[#214](bakdata/streams-bootstrap#214)

* [Gradle Release Plugin] - pre tag commit:  '2.23.0'. by @bakdata-bot

**Full Changelog**:
bakdata/streams-bootstrap@2.22.1...2.23.0

into this:
2024-06-12

* Add dynamic application.server config to streams app chart by
@philipp94831 in
[#214](bakdata/streams-bootstrap#214)

**Full Changelog**:
bakdata/streams-bootstrap@2.22.1...2.23.0

<hr>

For more config options have a look at the docs, this thing is pretty
powerful. Let me know what you think.
DerTiedemann added a commit that referenced this pull request Nov 19, 2024
commit 3fc6d36
Author: Jan Max Tiedemann <[email protected]>
Date:   Wed Nov 13 14:46:55 2024 +0100

    found it :3

commit 3a15742
Merge: 6c611e9 cb23302
Author: Jan Max Tiedemann <[email protected]>
Date:   Wed Nov 13 14:38:29 2024 +0100

    Merge branch 'main' into tiedemann/changelog-action-dont-clean

commit 6c611e9
Author: Jan Max Tiedemann <[email protected]>
Date:   Wed Nov 13 14:29:31 2024 +0100

    fix symlinks

commit 9bdd055
Author: Jan Max Tiedemann <[email protected]>
Date:   Wed Nov 13 14:28:28 2024 +0100

    rm symlinks

commit 1ef4c02
Author: Jan Max Tiedemann <[email protected]>
Date:   Wed Nov 13 14:27:05 2024 +0100

    remove symlinks

commit 933cb88
Author: Yannick Röder <[email protected]>
Date:   Wed Nov 13 14:04:24 2024 +0100

    Move checkout condition to changelog action

commit 1efda99
Author: Jan Max Tiedemann <[email protected]>
Date:   Wed Nov 13 11:49:20 2024 +0100

    feat: add input to skip checkout based on input flag

commit f82dac8
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Nov 12 17:06:26 2024 +0100

    fix: use proper branch

commit 9c0658e
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Nov 12 16:56:51 2024 +0100

    fix: add the input to the changelog action aswell

commit 178c7e2
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Nov 12 16:55:28 2024 +0100

    fix: make the clean step optional

commit 0207242
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Nov 12 16:42:41 2024 +0100

    fix: fixes deletion of uncommited files in the current working directory

commit e163e0b
Author: bakdata-bot <[email protected]>
Date:   Mon Nov 11 16:30:31 2024 +0000

    Bump version 1.48.0 → 1.49.0

commit 15ad433
Author: Yannick Röder <[email protected]>
Date:   Mon Nov 11 17:29:57 2024 +0100

    Revert pre-version bump in release workflow (#217)

commit f9ff265
Author: Yannick Röder <[email protected]>
Date:   Mon Nov 11 15:53:04 2024 +0100

    Update deprecated NodeJS actions (#215)

commit 9ac2b9f
Author: Yannick Röder <[email protected]>
Date:   Mon Nov 11 12:46:53 2024 +0100

    Update Python versions of Poetry setup test (#216)

commit 6318b88
Author: bakdata-bot <[email protected]>
Date:   Mon Nov 11 09:09:46 2024 +0000

    Bump version 1.47.0 → 1.48.0

commit 07b3b82
Author: DerTiedemann <[email protected]>
Date:   Mon Nov 11 10:08:45 2024 +0100

    feat: initial version of gsm secret loader (#213)

    This PR is the basis for the workload identity integration for GH
    workflows.
    Based on context it will load all secrets that are specified, transform
    their names to screaming snake case and export them.

    There are some tests and one is failing and i dont know why. All basic
    usecases work though.

    ---------

    Co-authored-by: Yannick Röder <[email protected]>

commit 5d0791b
Author: DerTiedemann <[email protected]>
Date:   Thu Nov 7 10:07:31 2024 +0100

    Adapt poetry release workflow for new changelog action (#214)

commit 994a5e8
Author: DerTiedemann <[email protected]>
Date:   Tue Nov 5 09:18:06 2024 +0100

    Feat: New changelog generator (#205)

    New changelog generator: https://git-cliff.org/
    This action updated replaces the previous generator with the
    aforementioned tool.

    All existing functionality has been preserved and some new things have
    been added, most notably the first contribution mention. The action will
    check of there is a `cliff.toml` present in the current repo and if not
    use the default that is present inside of this repo. Custom configs are
    sometimes required to filter out commits that dont contain meaningful
    changes like version bumps. An example of how this could look for
    streams-bootstrap:
    ```toml
    commit_parsers = [
      { message = "^\\[Gradle Release Plugin\\]", skip = true },
      { message = "^Changelog for version .*", skip = true },
    ]
    ```

    Which turns changelogs that look like this:
    2024-06-12

    * [Gradle Release Plugin] - new version commit: '2.22.2-SNAPSHOT'. by
    @bakdata-bot

    * Changelog for version 2.22.1 by @bakdata-bot

    * Add dynamic application.server config to streams app chart by
    @philipp94831 in
    [#214](bakdata/streams-bootstrap#214)

    * [Gradle Release Plugin] - pre tag commit:  '2.23.0'. by @bakdata-bot

    **Full Changelog**:
    bakdata/streams-bootstrap@2.22.1...2.23.0

    into this:
    2024-06-12

    * Add dynamic application.server config to streams app chart by
    @philipp94831 in
    [#214](bakdata/streams-bootstrap#214)

    **Full Changelog**:
    bakdata/streams-bootstrap@2.22.1...2.23.0

    <hr>

    For more config options have a look at the docs, this thing is pretty
    powerful. Let me know what you think.

commit b7da258
Author: bakdata-bot <[email protected]>
Date:   Mon Sep 2 07:56:56 2024 +0000

    Bump version 1.46.10 → 1.47.0

commit e4ec4a2
Author: bakdata-bot <[email protected]>
Date:   Mon Sep 2 07:54:20 2024 +0000

    Bump version 1.46.9 → 1.46.10

commit cbee7aa
Author: yordanovsstoyan <[email protected]>
Date:   Mon Sep 2 10:53:44 2024 +0300

    Add Additional Flags input for action-lint action (#211)

commit 7b274ea
Author: bakdata-bot <[email protected]>
Date:   Mon Aug 26 07:57:45 2024 +0000

    Bump version 1.46.8 → 1.46.9

commit 270ac8a
Author: yordanovsstoyan <[email protected]>
Date:   Mon Aug 26 10:57:18 2024 +0300

    Output Image Tag in java-gradle-build-jib Action (#210)

commit 651ae5d
Author: bakdata-bot <[email protected]>
Date:   Mon Aug 19 07:54:43 2024 +0000

    Bump version 1.46.7 → 1.46.8

commit 2320bce
Author: Philipp Schirmer <[email protected]>
Date:   Mon Aug 19 09:54:17 2024 +0200

    Fix maven setup action (#209)

commit f001d66
Author: DerTiedemann <[email protected]>
Date:   Thu Aug 15 10:15:12 2024 +0200

    tiedemann/bump java build actions (#202)

    I just bumped these to the latest vesion as i though this would fix my
    issue, i think it can go upsteam anyway.

commit 9c0667c
Author: bakdata-bot <[email protected]>
Date:   Thu Aug 15 07:50:38 2024 +0000

    Bump version 1.46.6 → 1.46.7

commit 2d1eacc
Author: yordanovsstoyan <[email protected]>
Date:   Thu Aug 15 10:50:10 2024 +0300

    Fix tagging java-gradle-build-jib action (#208)

    Co-authored-by: Yannick Röder <[email protected]>

commit 892c704
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 22:38:06 2024 +0200

    fix: make commit message correct

commit c3668a6
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 22:25:11 2024 +0200

    fix: persist credentials

commit 1800eff
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 22:19:28 2024 +0200

    fix: try using normal git commits

commit cb5bc5b
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 20:46:10 2024 +0200

    fix: try to use checkout to pull the latest changes

commit 5926df2
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 20:39:29 2024 +0200

    fix: add git config

commit e70c241
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 20:36:45 2024 +0200

    fix: add pull command

commit 78af696
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 10:19:44 2024 +0200

    fix: try with push

commit 9365e3d
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 10:13:26 2024 +0200

    fix: add git username + email

commit f1ec7de
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 10:10:16 2024 +0200

    fix: try single push

commit e091bd6
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 10:06:47 2024 +0200

    test

commit e170273
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 10:01:55 2024 +0200

    fix: use different commit message for second commit

commit 7df58c7
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 09:49:12 2024 +0200

    fix: new chamgelog action

commit 332f3eb
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 07:30:54 2024 +0200

    fix: proper outpuit

commit e58ea38
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 07:29:35 2024 +0200

    fix: only use bump

commit f1bc6f0
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 07:28:20 2024 +0200

    fix: remove deprecated flags

commit e592eec
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Sep 3 07:27:10 2024 +0200

    fix: make sure there is an empty string for the comparison

commit eda6cff
Author: Jan Max Tiedemann <[email protected]>
Date:   Mon Sep 2 08:30:22 2024 +0200

    Revert "chore: prep new version for release"

    This reverts commit c12b090.

commit c12b090
Author: Jan Max Tiedemann <[email protected]>
Date:   Mon Sep 2 08:29:27 2024 +0200

    chore: prep new version for release

commit fbfe193
Author: Jan Max Tiedemann <[email protected]>
Date:   Thu Aug 8 07:06:32 2024 +0200

    fix: add missing inline bash operator

commit 43f8923
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Aug 6 03:04:25 2024 +0200

    lint: fix actionlint complaints

commit 5eea497
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Aug 6 03:01:32 2024 +0200

    fix:
    - use bump-my-version instead of deprecated bump2version
    - merge snapshot action into bump action via parameter
    - WARN: requires special config - example given

commit a2a3e0c
Author: Jan Max Tiedemann <[email protected]>
Date:   Tue Aug 6 02:59:01 2024 +0200

    fix: remove redundant action

commit 2c7f4c0
Author: yordanovsstoyan <[email protected]>
Date:   Thu Nov 9 12:59:54 2023 +0200

    changes

commit 7a76951
Author: yordanovsstoyan <[email protected]>
Date:   Wed Oct 4 10:41:43 2023 +0300

    remove-variable

commit 0b030f3
Author: yordanovsstoyan <[email protected]>
Date:   Wed Oct 4 10:39:41 2023 +0300

    test

commit d0d3c60
Author: yordanovsstoyan <[email protected]>
Date:   Tue Oct 3 13:08:49 2023 +0300

    test

commit 54c86f7
Author: yordanovsstoyan <[email protected]>
Date:   Tue Oct 3 13:00:37 2023 +0300

    test

commit 78b45d4
Author: yordanovsstoyan <[email protected]>
Date:   Tue Oct 3 12:58:45 2023 +0300

    reboot

commit 99c4971
Author: stoyan.yordanov <[email protected]>
Date:   Thu Aug 31 09:23:26 2023 +0300

    commit-message

commit 82db094
Author: stoyan.yordanov <[email protected]>
Date:   Tue Aug 29 15:25:51 2023 +0300

    commit-message

commit a0416c6
Author: stoyan.yordanov <[email protected]>
Date:   Tue Aug 29 13:24:15 2023 +0300

    commit-message

commit 0375c17
Author: stoyan.yordanov <[email protected]>
Date:   Tue Aug 29 12:39:27 2023 +0300

    commit-message
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants