Skip to content

Commit

Permalink
Merge branch 'main' into iss704
Browse files Browse the repository at this point in the history
  • Loading branch information
orhun committed Nov 19, 2024
2 parents a6e1262 + d0848ff commit 2fbac89
Show file tree
Hide file tree
Showing 53 changed files with 2,235 additions and 591 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,9 @@ LICENSE
rustfmt.toml
_config.yml
.lycheeignore

# Ignore rust toolchain files as they would needlessly fetch the toolchain.
# But the image already contains a sufficient toolchain.
# Ignore both the latest naming and the legacy naming
rust-toolchain.toml
rust-toolchain
2 changes: 2 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
use flake
dotenv_if_exists .env
14 changes: 10 additions & 4 deletions .github/fixtures/test-bitbucket-integration/cliff.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,33 @@
[remote.bitbucket]
owner = "orhunp"
owner = "mcwarman-playground"
repo = "git-cliff-readme-example"

[changelog]
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{%- macro remote_url() -%}
https://bitbucket.org/{{ remote.bitbucket.owner }}/{{ remote.bitbucket.repo }}
{%- endmacro -%}
## What's Changed
{%- if version %} in {{ version }}{%- endif -%}
{% for commit in commits %}
* {{ commit.message | split(pat="\n") | first | trim }}\
{% if commit.remote.username %} by @{{ commit.remote.username }}{%- endif -%}
{% if commit.remote.pr_number %} in #{{ commit.remote.pr_number }}{%- endif %}
{% if commit.remote.pr_number %} in \
[#{{ commit.remote.pr_number }}]({{ self::remote_url() }}/pull-requests/{{ commit.remote.pr_number }})\
{%- endif %}
{%- endfor -%}
{% if bitbucket.contributors | filter(attribute="is_first_time", value=true) | length != 0 %}
{% raw %}\n{% endraw -%}
## New Contributors
### New Contributors
{%- endif %}\
{% for contributor in bitbucket.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 }}) \
[#{{ contributor.pr_number }}]({{ self::remote_url() }}/pull-requests/{{ contributor.pr_number }}) \
{%- endif %}
{%- endfor -%}
{% raw %}\n\n{% endraw -%}
Expand Down
2 changes: 1 addition & 1 deletion .github/fixtures/test-bitbucket-integration/commit.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -e

git remote add origin https://bitbucket.org/orhunp/git-cliff-readme-example
git remote add origin https://bitbucket.org/mcwarman-playground/git-cliff-readme-example
git pull origin master
git fetch --tags
4 changes: 4 additions & 0 deletions .github/fixtures/test-bitbucket-integration/expected.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## What's Changed
* feat(config): support multiple file formats by @orhun <[email protected]>
* feat(cache): use cache while fetching pages by @orhun <[email protected]>
* feat(ci): add pipeline config by @mcwarman <[email protected]> in [#1](https://bitbucket.org/mcwarman-playground/git-cliff-readme-example/pull-requests/1)

## What's Changed in v1.0.1
* refactor(parser): expose string functions by @orhun <[email protected]>
Expand All @@ -13,4 +14,7 @@
* fix(args): rename help argument due to conflict by @orhun <[email protected]>
* docs(example)!: add tested usage example by @orhun <[email protected]>

### New Contributors
* @orhun <[email protected]> made their first contribution

<!-- generated by -cliff -->
35 changes: 35 additions & 0 deletions .github/fixtures/test-conventional-commit/cliff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[changelog]
# template for the changelog footer
header = """
# Changelog\n
All notable changes to this project will be documented in this file.
"""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{% for group, commits in commits | group_by(attribute="group") %}
## {{ group | striptags | trim | upper_first }}
{% for commit in commits %}
{% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**]: {{ commit.breaking_description }}{% endif %}
{{ commit.message }}: {{ commit.body }}\
{% for footer in commit.footers %}
- {{ footer.token }}{{ footer.separator }} {{ footer.value }}\
{% endfor %}
{% endfor %}\
{% endfor %}\n
"""
# template for the changelog footer
footer = """
<!-- generated by git-cliff -->
"""

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# process each line of a commit as an individual commit
split_commits = false
commit_parsers = [
{ message = "^feat", group = "Features", default_scope = "app" },
{ message = "^fix" },
]
52 changes: 52 additions & 0 deletions .github/fixtures/test-conventional-commit/commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
set -e

GIT_COMMITTER_DATE="2022-04-06 01:25:08" git commit --allow-empty -m "Initial commit"
GIT_COMMITTER_DATE="2022-04-06 01:25:09" git commit --allow-empty -m \
"feat(web): feature 1, breaking change in footer
Body feature 1
BREAKING CHANGE: breaking change description feature 1
Signed-off-by: user1 <[email protected]>
Reviewed-by: user2
"

GIT_COMMITTER_DATE="2022-04-06 01:25:10" git commit --allow-empty -m \
"feat(web)!: feature 2, breaking chain in description
Body feature 2
Signed-off-by: user3 <[email protected]>
"

GIT_COMMITTER_DATE="2022-04-06 01:25:11" git commit --allow-empty -m \
"feat!: feature 3, use default scope = app
Body feature 2
Signed-off-by: user3 <[email protected]>
"

GIT_COMMITTER_DATE="2022-04-06 01:25:12" git commit --allow-empty -m \
"fix(scope): fix 1, use scope as group
Body fix 1
Fix: #1
"

GIT_COMMITTER_DATE="2022-04-06 01:25:13" git commit --allow-empty -m \
"fix(front-end): fix 2, no footer
Body fix 2
"

GIT_COMMITTER_DATE="2022-04-06 01:25:14" git commit --allow-empty -m \
"fix(front-end): fix 3 and 4, no body but footer
Fix: #3
Fix: #4
"

git tag v0.1.0
35 changes: 35 additions & 0 deletions .github/fixtures/test-conventional-commit/expected.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Changelog

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

## Features

*(web)* [**breaking**]: breaking change description feature 1
feature 1, breaking change in footer: Body feature 1
- BREAKING CHANGE: breaking change description feature 1
- Signed-off-by: user1 <[email protected]>
- Reviewed-by: user2

*(web)* [**breaking**]: feature 2, breaking chain in description
feature 2, breaking chain in description: Body feature 2
- Signed-off-by: user3 <[email protected]>

*(app)* [**breaking**]: feature 3, use default scope = app
feature 3, use default scope = app: Body feature 2
- Signed-off-by: user3 <[email protected]>

## Fix

*(scope)*
fix 1, use scope as group: Body fix 1
- Fix: #1

*(front-end)*
fix 2, no footer: Body fix 2

*(front-end)*
fix 3 and 4, no body but footer:
- Fix: #3
- Fix: #4

<!-- generated by git-cliff -->
4 changes: 2 additions & 2 deletions .github/fixtures/test-fixtures-locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export FIXTURES_DIR="$SCRIPT_DIR/$1"

# Set up a temporary repository
cd "$(mktemp -d)"
git init
git init >&2

# Commit
"$FIXTURES_DIR/commit.sh"
Expand All @@ -31,5 +31,5 @@ if [ -n "$MSYSTEM" ] && [ "$MSYSTEM" = "MINGW64" ]; then
fi

# Show results
echo -e "\n---Run git-cliff---"
echo -e "\n---Run git-cliff---" >&2
cargo run --manifest-path "$SCRIPT_DIR/../../Cargo.toml" -- -vv --config "$FIXTURES_DIR/cliff.toml" "${@:2}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[changelog]
# template for the changelog footer
header = """
# Changelog\n
All notable changes to this project will be documented in this file.
"""
# template for the changelog body
# https://keats.github.io/tera/docs/#introduction
body = """
{% for group, commits in commits | group_by(attribute="group") %}
## {{ group | striptags | trim | upper_first }}
{% for commit in commits %}
{% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{% if commit.breaking %}[**breaking**]: {{ commit.breaking_description }}{% endif %}
{{ commit.message }}: {{ commit.body }}\
{% for footer in commit.footers %}
- {{ footer.token }}{{ footer.separator }} {{ footer.value }}\
{% endfor %}
{% endfor %}\
{% endfor %}\n
"""
# template for the changelog footer
footer = """
<!-- generated by git-cliff -->
"""

[git]
# parse the commits based on https://www.conventionalcommits.org
conventional_commits = true
# process each line of a commit as an individual commit
split_commits = false
commit_parsers = [
{ message = "^feat", group = "Features", default_scope = "app" },
{ message = "^fix" },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash
set -e

GIT_COMMITTER_DATE="2022-04-06 01:25:08" git commit --allow-empty -m "Initial commit"
GIT_COMMITTER_DATE="2022-04-06 01:25:09" git commit --allow-empty -m \
"feat(web): feature 1, breaking change in footer
Body feature 1
BREAKING CHANGE: breaking change description feature 1
Signed-off-by: user1 <[email protected]>
Reviewed-by: user2
"

GIT_COMMITTER_DATE="2022-04-06 01:25:10" git commit --allow-empty -m \
"feat(web)!: feature 2, breaking chain in description
Body feature 2
Signed-off-by: user3 <[email protected]>
"

GIT_COMMITTER_DATE="2022-04-06 01:25:11" git commit --allow-empty -m \
"feat!: feature 3, use default scope = app
Body feature 2
Signed-off-by: user3 <[email protected]>
"

GIT_COMMITTER_DATE="2022-04-06 01:25:12" git commit --allow-empty -m \
"fix(scope): fix 1, use scope as group
Body fix 1
Fix: #1
"

GIT_COMMITTER_DATE="2022-04-06 01:25:13" git commit --allow-empty -m \
"fix(front-end): fix 2, no footer
Body fix 2
"

GIT_COMMITTER_DATE="2022-04-06 01:25:14" git commit --allow-empty -m \
"fix(front-end): fix 3 and 4, no body but footer
Fix: #3
Fix: #4
"

git tag v0.1.0
Loading

0 comments on commit 2fbac89

Please sign in to comment.