-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
refactor(config)!: revamp configuration #559
base: main
Are you sure you want to change the base?
Changes from all commits
2193936
a3f2f8b
8ead718
02bf5bb
d7679c6
f69dfe4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,74 @@ | ||
name: Run a fixtures test | ||
description: Run a fixtures test | ||
|
||
inputs: | ||
fixtures-dir: | ||
description: Path to the fixtures directory | ||
required: true | ||
command: | ||
description: The git-cliff command to run | ||
required: false | ||
default: "" | ||
date-format: | ||
description: The date format to use | ||
required: false | ||
default: "%Y-%m-%d" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install toolchain | ||
uses: dtolnay/rust-toolchain@nightly | ||
|
||
- name: Install git-cliff | ||
run: cargo install --path git-cliff/ | ||
shell: bash | ||
|
||
- name: Set git config | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
shell: bash | ||
|
||
- name: Create commits and tags | ||
working-directory: ${{ inputs.fixtures-dir }} | ||
run: | | ||
git init | ||
./commit.sh | ||
shell: bash | ||
|
||
- name: Generate a changelog | ||
working-directory: ${{ inputs.fixtures-dir }} | ||
run: git cliff --config cliff.toml ${{ inputs.command }} > output.md | ||
shell: bash | ||
|
||
- name: Compare the output with the expected output | ||
working-directory: ${{ inputs.fixtures-dir }} | ||
env: | ||
IN_DATE_FORMAT: ${{ inputs.date-format }} | ||
run: | | ||
cat output.md | ||
current_date=$(date +"$IN_DATE_FORMAT") | ||
sed -i "s/<<DATE>>/$current_date/g" expected.md | ||
diff --strip-trailing-cr output.md expected.md | ||
shell: bash | ||
name: Run a fixtures test | ||
description: Run a fixtures test | ||
|
||
inputs: | ||
fixtures-dir: | ||
description: Path to the fixtures directory | ||
required: true | ||
command: | ||
description: The git-cliff command to run | ||
required: false | ||
default: "" | ||
date-format: | ||
description: The date format to use | ||
required: false | ||
default: "%Y-%m-%d" | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Install toolchain | ||
uses: dtolnay/rust-toolchain@nightly | ||
|
||
- name: Install git-cliff | ||
run: cargo install --path git-cliff/ | ||
shell: bash | ||
|
||
- name: Set git config | ||
run: | | ||
git config --global user.name "github-actions[bot]" | ||
git config --global user.email "github-actions[bot]@users.noreply.github.com" | ||
shell: bash | ||
|
||
- name: Create commits and tags | ||
working-directory: ${{ inputs.fixtures-dir }} | ||
run: | | ||
git init | ||
./commit.sh | ||
shell: bash | ||
|
||
- name: Generate a changelog | ||
working-directory: ${{ inputs.fixtures-dir }} | ||
run: git cliff --config cliff.toml ${{ inputs.command }} > output.md | ||
shell: bash | ||
|
||
- name: Compare the output with the expected output | ||
working-directory: ${{ inputs.fixtures-dir }} | ||
env: | ||
IN_DATE_FORMAT: ${{ inputs.date-format }} | ||
run: | | ||
cat output.md | ||
current_date=$(date +"$IN_DATE_FORMAT") | ||
sed -i "s/<<DATE>>/$current_date/g" expected.md | ||
diff --strip-trailing-cr output.md expected.md | ||
shell: bash | ||
|
||
# test backwards compatibility using v1 confiuration | ||
|
||
- name: Generate a chanlog using v1 configuration | ||
if: ${{ hashFiles(format('{0}/cliff.v1.toml', inputs.fixtures-dir)) }} | ||
working-directory: ${{ inputs.fixtures-dir }} | ||
run: git-cliff --config cliff.v1.toml --config-version 1 ${{ inputs.command }} > output.md | ||
shell: bash | ||
|
||
- name: Compare the v1 configuration output with the expected output | ||
if: ${{ hashFiles(format('{0}/cliff.v1.toml', inputs.fixtures-dir)) }} | ||
working-directory: ${{ inputs.fixtures-dir }} | ||
env: | ||
IN_DATE_FORMAT: ${{ inputs.date-format }} | ||
run: | | ||
cat output.md | ||
current_date=$(date +"$IN_DATE_FORMAT") | ||
sed -i "s/<<DATE>>/$current_date/g" expected.md | ||
diff --strip-trailing-cr output.md expected.md | ||
shell: bash |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
[changelog] | ||
# changelog header | ||
# A static header for the changelog. | ||
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 = """ | ||
# A Tera template to be rendered for each release in the changelog (see https://keats.github.io/tera/docs/#introduction). | ||
body_template = """ | ||
{% if version %}\ | ||
## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} | ||
{% else %}\ | ||
|
@@ -19,15 +18,16 @@ body = """ | |
{% endfor %} | ||
{% endfor %}\n | ||
""" | ||
# template for the changelog footer | ||
footer = """ | ||
# A Tera template to be rendered as the changelog's footer (see https://keats.github.io/tera/docs/#introduction). | ||
footer_template = """ | ||
<!-- generated by git-cliff --> | ||
""" | ||
# remove the leading and trailing whitespace from the templates | ||
trim = true | ||
# Whether to remove leading and trailing whitespaces from all lines of the changelog's body. | ||
trim_body_whitespace = true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesn't this also trim new lines? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unless I misunderstand the code in git-cliff-core/src/template.rs:34, this option does not remove newlines. |
||
|
||
[git] | ||
# regex for parsing and grouping commits | ||
[commit] | ||
# A list of parsers using regex for extracting data from the commit message. | ||
# Sets the commits' `group` and `scope` and can decide to exclude commits from further processing. | ||
commit_parsers = [ | ||
{ message = "^feat", group = "Features", default_scope = "app" }, | ||
{ message = "^fix", group = "Bug Fixes", scope = "cli" }, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we make
header
a template too and remove_template
from all the changelog parts?Probably this suggestion would have been better when discussing the issue, but I didn't pay enough attention, so sorry about that!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that would certainly be a good idea. I didn't do that yet, because I wanted to keep the changes distinct. But I can add it to this PR.