From 116d08d308e52ff6a31c575797f18f469a80c5df Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Mon, 18 Nov 2024 17:50:32 +0100 Subject: [PATCH 1/6] Fix changelog creation to also show PRs that don't have conventional commits --- cliff.toml | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/cliff.toml b/cliff.toml index 29228543e..b120914cf 100644 --- a/cliff.toml +++ b/cliff.toml @@ -35,7 +35,7 @@ footer = """ trim = true # postprocessors postprocessors = [ - # { pattern = '', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL + # { pattern = '', replace = "https://github.com/orhun/git-cliff" }, # replace repository URL ] [git] @@ -47,24 +47,26 @@ filter_unconventional = false split_commits = false # regex for preprocessing the commit messages commit_preprocessors = [ - # Replace issue numbers - #{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](/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 -' }, + # Replace issue numbers + #{ pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](/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 -' }, ] # regex for parsing and grouping commits commit_parsers = [ - { message = "^feat", group = "๐Ÿš€ Features" }, - { message = "^fix", group = "๐Ÿ› Bug Fixes" }, - { message = "^doc", group = "๐Ÿ“š Documentation" }, - { message = "^perf", group = "โšก Performance" }, - { message = "^refactor", group = "๐Ÿšœ Refactor" }, - { message = "^style", group = "๐ŸŽจ Styling" }, - { message = "^test", group = "๐Ÿงช Testing" }, - { message = "^chore|^ci", group = "โš™๏ธ Miscellaneous Tasks" }, - { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, - { message = "^revert", group = "โ—€๏ธ Revert" }, + { message = "^feat", group = "๐Ÿš€ Features" }, + { message = "^fix", group = "๐Ÿ› Bug Fixes" }, + { message = "^doc", group = "๐Ÿ“š Documentation" }, + { message = "^perf", group = "โšก Performance" }, + { message = "^refactor", group = "๐Ÿšœ Refactor" }, + { message = "^style", group = "๐ŸŽจ Styling" }, + { message = "^test", group = "๐Ÿงช Testing" }, + { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, + { message = "^revert", group = "โ—€๏ธ Revert" }, + { message = "^ci", group = "โš™๏ธ CI" }, + { message = "^chore", group = "๐Ÿงน Chores" }, + { message = ".*", group = "๐ŸŒ€ Miscellaneous" }, ] # protect breaking changes from being skipped due to matching a skipping commit_parser protect_breaking_commits = false From 7cbca6c62afa959b969591c2a134fa39c5f059a4 Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Mon, 18 Nov 2024 17:50:51 +0100 Subject: [PATCH 2/6] Fix file glob for changelog creation --- .github/workflows/CI_pypi_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI_pypi_release.yml b/.github/workflows/CI_pypi_release.yml index e29d3ea36..1162ca3b3 100644 --- a/.github/workflows/CI_pypi_release.yml +++ b/.github/workflows/CI_pypi_release.yml @@ -54,7 +54,7 @@ jobs: with: config: cliff.toml args: > - --include-path "${{ steps.pathfinder.outputs.project_path }}/*" + --include-path "${{ steps.pathfinder.outputs.project_path }}/**/*" --tag-pattern "${{ steps.pathfinder.outputs.project_path }}-v*" - name: Commit changelog From d4c380bcf2cd454053f17aa3534e523e3cde290b Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Tue, 19 Nov 2024 10:00:44 +0100 Subject: [PATCH 3/6] Handle commits with multiple lines --- cliff.toml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/cliff.toml b/cliff.toml index b120914cf..ff9649f6b 100644 --- a/cliff.toml +++ b/cliff.toml @@ -23,7 +23,24 @@ body = """ {% for commit in commits %} - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\ {% if commit.breaking %}[**breaking**] {% endif %}\ - {{ commit.message | upper_first }}\ + {# + We first try to render the conventional commit message if present. + If it's not a conventional commit we get the PR title if present. + If the commit is neither conventional, nor has a PR title set + we fallback to whatever the commit message is. + + We do this cause when merging PRs with multiple commits that don't + have a title following conventional commit guidelines we might get + a commit message that is multiple lines. That makes the changelog + look a bit funky so we handle it like so. + #}\ + {% if commit.conventional %}\ + {{ commit.message | upper_first }}\ + {% elif commit.remote.pr_title %}\ + {{ commit.remote.pr_title | upper_first }}\ + {% else %}\ + {{ commit.message | upper_first }}\ + {% endif %}\ {% endfor %} {% endfor %}\n """ @@ -84,3 +101,7 @@ topo_order = false sort_commits = "oldest" # limit the number of commits included in the changelog. # limit_commits = 42 + +[remote.github] +owner = "deepset-ai" +repo = "haystack-core-integrations" From 00592d6bb1245d19af41f00c3a77d7960cea2a33 Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Tue, 19 Nov 2024 10:05:25 +0100 Subject: [PATCH 4/6] Add PR number --- cliff.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cliff.toml b/cliff.toml index ff9649f6b..631e89d11 100644 --- a/cliff.toml +++ b/cliff.toml @@ -37,7 +37,7 @@ body = """ {% if commit.conventional %}\ {{ commit.message | upper_first }}\ {% elif commit.remote.pr_title %}\ - {{ commit.remote.pr_title | upper_first }}\ + {{ commit.remote.pr_title | upper_first }} (#{{ commit.remote.pr_number }})\ {% else %}\ {{ commit.message | upper_first }}\ {% endif %}\ From d997d86b56147c903fef74d420f3a6c429c99aef Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Tue, 19 Nov 2024 10:18:19 +0100 Subject: [PATCH 5/6] Hide commits that just update the changelog --- cliff.toml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cliff.toml b/cliff.toml index 631e89d11..4beda419a 100644 --- a/cliff.toml +++ b/cliff.toml @@ -19,8 +19,23 @@ body = """ ## [unreleased] {% endif %}\ {% for group, commits in commits | group_by(attribute="group") %} + {# + Skip the whole section if it contains only a single commit + and it's the commit that updated the changelog. + If we don't do this we get an empty section since we don't show + commits that update the changelog + #}\ + {% if commits | length == 1 and commits[0].message == 'Update the changelog' %}\ + {% continue %}\ + {% endif %}\ ### {{ group | striptags | trim | upper_first }} - {% for commit in commits %} + {% for commit in commits %}\ + {# + Skip commits that update the changelog, they're not useful to the user + #}\ + {% if commit.message == 'Update the changelog' %}\ + {% continue %}\ + {% endif %} - {% if commit.scope %}*({{ commit.scope }})* {% endif %}\ {% if commit.breaking %}[**breaking**] {% endif %}\ {# From 113d3f4c4c0cfc202e426e6b8c81c41ce4204109 Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Tue, 19 Nov 2024 10:22:01 +0100 Subject: [PATCH 6/6] Fix sorting --- cliff.toml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cliff.toml b/cliff.toml index 4beda419a..45e4c647b 100644 --- a/cliff.toml +++ b/cliff.toml @@ -87,16 +87,16 @@ commit_preprocessors = [ ] # regex for parsing and grouping commits commit_parsers = [ - { message = "^feat", group = "๐Ÿš€ Features" }, - { message = "^fix", group = "๐Ÿ› Bug Fixes" }, - { message = "^doc", group = "๐Ÿ“š Documentation" }, - { message = "^perf", group = "โšก Performance" }, - { message = "^refactor", group = "๐Ÿšœ Refactor" }, - { message = "^style", group = "๐ŸŽจ Styling" }, - { message = "^test", group = "๐Ÿงช Testing" }, - { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, - { message = "^revert", group = "โ—€๏ธ Revert" }, - { message = "^ci", group = "โš™๏ธ CI" }, + { message = "^feat", group = "๐Ÿš€ Features" }, + { message = "^fix", group = "๐Ÿ› Bug Fixes" }, + { message = "^refactor", group = "๐Ÿšœ Refactor" }, + { message = "^doc", group = "๐Ÿ“š Documentation" }, + { message = "^perf", group = "โšก Performance" }, + { message = "^style", group = "๐ŸŽจ Styling" }, + { message = "^test", group = "๐Ÿงช Testing" }, + { body = ".*security", group = "๐Ÿ›ก๏ธ Security" }, + { message = "^revert", group = "โ—€๏ธ Revert" }, + { message = "^ci", group = "โš™๏ธ CI" }, { message = "^chore", group = "๐Ÿงน Chores" }, { message = ".*", group = "๐ŸŒ€ Miscellaneous" }, ]