-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
Open
Cyclonit
wants to merge
6
commits into
orhun:main
Choose a base branch
from
Cyclonit:feature/revamp_configuration
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2193936
feature(config): introduce new configuration schema
Cyclonit a3f2f8b
feature(config): add migrate-config subcommand
Cyclonit 8ead718
feature(config): add support for both configuration versions
Cyclonit 02bf5bb
doc(config): add documentation for configuration revamp
Cyclonit d7679c6
feature(config): improve support for backwards compatability
Cyclonit f69dfe4
test(config): add tests for backwards compatibility
Cyclonit File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" }, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.