From 46b454215547a4298a79f1252caccf2d63890141 Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Sun, 6 Feb 2022 02:29:34 +0900 Subject: [PATCH 01/19] feat(changelog, config)!: replace --topo-order by --date-order Signed-off-by: Kenji Miyake --- .github/fixtures/cliff.toml | 4 ++-- README.md | 16 ++++++++-------- config/cliff.toml | 4 ++-- examples/detailed.toml | 4 ++-- examples/keepachangelog.toml | 4 ++-- examples/scoped.toml | 4 ++-- examples/scopesorted.toml | 4 ++-- examples/unconventional.toml | 4 ++-- git-cliff-core/src/config.rs | 4 ++-- git-cliff-core/src/repo.rs | 4 ++-- git-cliff-core/tests/integration_test.rs | 2 +- git-cliff/src/args.rs | 4 ++-- git-cliff/src/changelog.rs | 2 +- git-cliff/src/lib.rs | 8 ++++---- 14 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/fixtures/cliff.toml b/.github/fixtures/cliff.toml index 01adea2962..68bf27d9a9 100644 --- a/.github/fixtures/cliff.toml +++ b/.github/fixtures/cliff.toml @@ -53,7 +53,7 @@ tag_pattern = "v[0-9]*" skip_tags = "v0.1.0-beta.1" # regex for ignoring tags ignore_tags = "v.*-beta.*" -# sort the tags topologically -topo_order = false +# sort the tags chronologically +date_order = false # sort the commits inside sections by oldest/newest order sort_commits = "oldest" diff --git a/README.md b/README.md index 61822ad04d..b1293c5434 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ - [tag_pattern](#tag_pattern) - [skip_tags](#skip_tags) - [ignore_tags](#ignore_tags) - - [topo_order](#topo_order) + - [date_order](#date_order) - [sort_commits](#sort_commits) - [Templating](#templating) - [Context](#context) @@ -142,7 +142,7 @@ git-cliff [FLAGS] [OPTIONS] [--] [RANGE] -l, --latest Processes the commits starting from the latest tag --current Processes the commits that belong to the current tag -u, --unreleased Processes the commits that do not belong to a tag - --topo-order Sorts the tags topologically + --date-order Sorts the tags chronologically. -h, --help Prints help information -V, --version Prints version information ``` @@ -245,11 +245,11 @@ git cliff --sort oldest git cliff --sort newest ``` -Sort the tags in topological order: +Sort the tags in chronological order: ```sh -# Process in topological order instead of chronological. -git cliff --topo-order +# Process in chronological order instead of topological. +git cliff --date-order ``` Save the changelog file to the specified file: @@ -404,7 +404,7 @@ filter_commits = false tag_pattern = "v[0-9]*" skip_tags = "v0.1.0-beta.1" ignore_tags = "" -topo_order = false +date_order = false sort_commits = "oldest" link_parsers = [ { pattern = "#(\\d+)", href = "https://github.com/orhun/git-cliff/issues/$1"}, @@ -500,11 +500,11 @@ A regex for ignore processing the matched tags. While `skip_tags` drop commits from the changelog, `ignore_tags` include ignored commits into the next tag. -#### topo_order +#### date_order If set to `true`, tags are processed in topological order instead of chronological. -This can also be achieved by using the `--topo-order` command line flag. +This can also be achieved by using the `--date-order` command line flag. #### sort_commits diff --git a/config/cliff.toml b/config/cliff.toml index d1bbc1585a..7a85fd1d6f 100644 --- a/config/cliff.toml +++ b/config/cliff.toml @@ -54,7 +54,7 @@ tag_pattern = "v[0-9]*" skip_tags = "v0.1.0-beta.1" # regex for ignoring tags ignore_tags = "" -# sort the tags topologically -topo_order = false +# sort the tags chronologically +date_order = false # sort the commits inside sections by oldest/newest order sort_commits = "oldest" diff --git a/examples/detailed.toml b/examples/detailed.toml index bb8616ecb1..b6b57fdd35 100644 --- a/examples/detailed.toml +++ b/examples/detailed.toml @@ -60,7 +60,7 @@ tag_pattern = "v[0-9]*" skip_tags = "v0.1.0-beta.1" # regex for ignoring tags ignore_tags = "" -# sort the tags topologically -topo_order = false +# sort the tags chronologically +date_order = false # sort the commits inside sections by oldest/newest order sort_commits = "oldest" diff --git a/examples/keepachangelog.toml b/examples/keepachangelog.toml index 2cc18a9ef4..f6552c2493 100644 --- a/examples/keepachangelog.toml +++ b/examples/keepachangelog.toml @@ -55,7 +55,7 @@ tag_pattern = "v[0-9]*" skip_tags = "v0.1.0-beta.1" # regex for ignoring tags ignore_tags = "" -# sort the tags topologically -topo_order = false +# sort the tags chronologically +date_order = false # sort the commits inside sections by oldest/newest order sort_commits = "oldest" diff --git a/examples/scoped.toml b/examples/scoped.toml index 0a3d2d3cf8..996b2f4697 100644 --- a/examples/scoped.toml +++ b/examples/scoped.toml @@ -57,7 +57,7 @@ tag_pattern = "v[0-9]*" skip_tags = "v0.1.0-beta.1" # regex for ignoring tags ignore_tags = "" -# sort the tags topologically -topo_order = false +# sort the tags chronologically +date_order = false # sort the commits inside sections by oldest/newest order sort_commits = "oldest" diff --git a/examples/scopesorted.toml b/examples/scopesorted.toml index 9ca9410db3..0f2f7dee3c 100644 --- a/examples/scopesorted.toml +++ b/examples/scopesorted.toml @@ -69,7 +69,7 @@ tag_pattern = "v[0-9]*" skip_tags = "v0.1.0-beta.1" # regex for ignoring tags ignore_tags = "" -# sort the tags topologically -topo_order = false +# sort the tags chronologically +date_order = false # sort the commits inside sections by oldest/newest order sort_commits = "oldest" diff --git a/examples/unconventional.toml b/examples/unconventional.toml index f829797cf8..26cf18ef0a 100644 --- a/examples/unconventional.toml +++ b/examples/unconventional.toml @@ -55,7 +55,7 @@ tag_pattern = "v[0-9]*" skip_tags = "v0.1.0-beta.1" # regex for ignoring tags ignore_tags = "" -# sort the tags topologically -topo_order = false +# sort the tags chronologically +date_order = false # sort the commits inside sections by oldest/newest order sort_commits = "oldest" diff --git a/git-cliff-core/src/config.rs b/git-cliff-core/src/config.rs index cc6423ba91..fa55859344 100644 --- a/git-cliff-core/src/config.rs +++ b/git-cliff-core/src/config.rs @@ -47,8 +47,8 @@ pub struct GitConfig { #[serde(with = "serde_regex", default)] /// Regex to ignore matched tags. pub ignore_tags: Option, - /// Whether to sort tags topologically. - pub topo_order: Option, + /// Whether to sort tags chronologically. + pub date_order: Option, /// Sorting of the commits inside sections. pub sort_commits: Option, } diff --git a/git-cliff-core/src/repo.rs b/git-cliff-core/src/repo.rs index 46b41dbbb7..347542ae75 100644 --- a/git-cliff-core/src/repo.rs +++ b/git-cliff-core/src/repo.rs @@ -107,7 +107,7 @@ impl Repository { pub fn tags( &self, pattern: &Option, - topo_order: bool, + date_order: bool, ) -> Result> { let mut tags: Vec<(Commit, String)> = Vec::new(); let tag_names = self.inner.tag_names(pattern.as_deref())?; @@ -125,7 +125,7 @@ impl Repository { } } } - if !topo_order { + if date_order { tags.sort_by(|a, b| a.0.time().seconds().cmp(&b.0.time().seconds())); } Ok(tags diff --git a/git-cliff-core/tests/integration_test.rs b/git-cliff-core/tests/integration_test.rs index 5fb5da6663..150c8af2e3 100644 --- a/git-cliff-core/tests/integration_test.rs +++ b/git-cliff-core/tests/integration_test.rs @@ -59,7 +59,7 @@ fn generate_changelog() -> Result<()> { tag_pattern: None, skip_tags: None, ignore_tags: None, - topo_order: None, + date_order: None, sort_commits: None, link_parsers: Some(vec![ LinkParser { diff --git a/git-cliff/src/args.rs b/git-cliff/src/args.rs index 0c8e52dc60..e74b3c68e8 100644 --- a/git-cliff/src/args.rs +++ b/git-cliff/src/args.rs @@ -91,9 +91,9 @@ pub struct Opt { /// Processes the commits that do not belong to a tag. #[clap(short, long, help_heading = Some("FLAGS"))] pub unreleased: bool, - /// Sorts the tags topologically. + /// Sorts the tags chronologically. #[clap(long, help_heading = Some("FLAGS"))] - pub topo_order: bool, + pub date_order: bool, /// Strips the given parts from the changelog. #[clap(short, long, value_name = "PART", arg_enum)] pub strip: Option, diff --git a/git-cliff/src/changelog.rs b/git-cliff/src/changelog.rs index 5651d30095..178c4c0356 100644 --- a/git-cliff/src/changelog.rs +++ b/git-cliff/src/changelog.rs @@ -222,7 +222,7 @@ mod test { tag_pattern: None, skip_tags: Regex::new("v3.*").ok(), ignore_tags: None, - topo_order: Some(false), + date_order: Some(false), sort_commits: Some(String::from("oldest")), link_parsers: None, }, diff --git a/git-cliff/src/lib.rs b/git-cliff/src/lib.rs index 6542ef743d..e7deab7750 100644 --- a/git-cliff/src/lib.rs +++ b/git-cliff/src/lib.rs @@ -107,9 +107,9 @@ pub fn run(mut args: Opt) -> Result<()> { .expect("Incorrect config value for 'sort_commits'"); } } - if !args.topo_order { - if let Some(topo_order) = config.git.topo_order { - args.topo_order = topo_order; + if !args.date_order { + if let Some(date_order) = config.git.date_order { + args.date_order = date_order; } } @@ -118,7 +118,7 @@ pub fn run(mut args: Opt) -> Result<()> { Repository::init(args.repository.unwrap_or(env::current_dir()?))?; // Parse tags. - let mut tags = repository.tags(&config.git.tag_pattern, args.topo_order)?; + let mut tags = repository.tags(&config.git.tag_pattern, args.date_order)?; // Skip tags. let skip_regex = config.git.skip_tags.as_ref(); From 8c242d89faa354e363729442f8d13193adc4a18f Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Sun, 6 Feb 2022 02:51:18 +0900 Subject: [PATCH 02/19] ci: simplify test-fixtures workflow Signed-off-by: Kenji Miyake --- .github/actions/run-fixtures-test/action.yml | 46 +++++++++++++++++++ .../{ => test-ignore-tags}/cliff.toml | 0 .github/fixtures/test-ignore-tags/commit.sh | 15 ++++++ .../{ => test-ignore-tags}/expected.md | 0 .github/workflows/test-fixtures.yml | 45 +++++------------- 5 files changed, 72 insertions(+), 34 deletions(-) create mode 100644 .github/actions/run-fixtures-test/action.yml rename .github/fixtures/{ => test-ignore-tags}/cliff.toml (100%) create mode 100755 .github/fixtures/test-ignore-tags/commit.sh rename .github/fixtures/{ => test-ignore-tags}/expected.md (100%) diff --git a/.github/actions/run-fixtures-test/action.yml b/.github/actions/run-fixtures-test/action.yml new file mode 100644 index 0000000000..52bbdcaa1b --- /dev/null +++ b/.github/actions/run-fixtures-test/action.yml @@ -0,0 +1,46 @@ +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: "" + +runs: + using: composite + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set git config + run: | + git config --global user.name github-actions + git config --global user.email github-actions@github.com + shell: bash + + - name: Create commits and tags + working-directory: ${{ inputs.fixtures-dir }} + run: | + git init + ./commit.sh + env: + GIT_AUTHOR_DATE: "2021-01-23 01:23:45" + GIT_COMMITTER_DATE: "2021-01-23 01:23:45" + shell: bash + + - name: Generate a changelog + working-directory: ${{ inputs.fixtures-dir }} + run: | + cargo run -- --config cliff.toml ${{ inputs.command }} > output.md + shell: bash + + - name: Compare the output with the expected output + working-directory: ${{ inputs.fixtures-dir }} + run: | + cat output.md + diff --strip-trailing-cr output.md expected.md + shell: bash diff --git a/.github/fixtures/cliff.toml b/.github/fixtures/test-ignore-tags/cliff.toml similarity index 100% rename from .github/fixtures/cliff.toml rename to .github/fixtures/test-ignore-tags/cliff.toml diff --git a/.github/fixtures/test-ignore-tags/commit.sh b/.github/fixtures/test-ignore-tags/commit.sh new file mode 100755 index 0000000000..07b7e8d211 --- /dev/null +++ b/.github/fixtures/test-ignore-tags/commit.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -e + +git commit --allow-empty -m "feat: add skip feature" +git tag v0.1.0-beta.1 + +git commit --allow-empty -m "feat: add feature 1" +git commit --allow-empty -m "feat: fix feature 1" +git tag v0.1.0 + +git commit --allow-empty -m "feat: add feature 2" +git tag v0.2.0-beta.1 + +git commit --allow-empty -m "feat: add feature 3" +git tag v0.2.0 \ No newline at end of file diff --git a/.github/fixtures/expected.md b/.github/fixtures/test-ignore-tags/expected.md similarity index 100% rename from .github/fixtures/expected.md rename to .github/fixtures/test-ignore-tags/expected.md diff --git a/.github/workflows/test-fixtures.yml b/.github/workflows/test-fixtures.yml index 875d362658..61f8742a3b 100644 --- a/.github/workflows/test-fixtures.yml +++ b/.github/workflows/test-fixtures.yml @@ -12,41 +12,18 @@ jobs: test-fixtures: name: Test fixtures runs-on: ubuntu-latest + container: rust:latest + strategy: + fail-fast: false + matrix: + fixtures-name: + - test-ignore-tags steps: - name: Checkout uses: actions/checkout@v2 + + - name: Run a fixtures test + uses: ./.github/actions/run-fixtures-test with: - fetch-depth: 0 - - name: Set git config - run: | - git config --global user.name github-actions - git config --global user.email github-actions@github.com - - name: Create commits and tags - run: | - mkdir .workspace && cd .workspace && git init - git commit --allow-empty -m "Initial commit" - git commit --allow-empty -m "feat: add skip feature" - git tag v0.1.0-beta.1 - git commit --allow-empty -m "feat: add feature 1" - git commit --allow-empty -m "feat: fix feature 1" - git tag v0.1.0 - git commit --allow-empty -m "feat: add feature 2" - git tag v0.2.0-beta.1 - git commit --allow-empty -m "feat: add feature 3" - git tag v0.2.0 - env: - GIT_AUTHOR_DATE: "2021-01-23 01:23:45" - GIT_COMMITTER_DATE: "2021-01-23 01:23:45" - - name: Generate a changelog - run: | - cd .workspace - fixtures_dir=${GITHUB_WORKSPACE}/.github/fixtures - docker run -t \ - -v "$(pwd)/.git":/app/ \ - -v "$fixtures_dir/cliff.toml":/app/cliff.toml \ - orhunp/git-cliff:latest > "$fixtures_dir/output.md" - - name: Compare the output with the expected output - run: | - cd ${GITHUB_WORKSPACE}/.github/fixtures - cat output.md - diff --strip-trailing-cr output.md expected.md + fixtures-dir: .github/fixtures/${{ matrix.fixtures-name }} + command: ${{ matrix.command }} From 12d08f4b30c792df04bd6599e44bb3e06705d943 Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Sun, 6 Feb 2022 03:57:16 +0900 Subject: [PATCH 03/19] ci: add fixtures tests of topo_order and date_order Signed-off-by: Kenji Miyake --- .github/fixtures/test-date-order/cliff.toml | 60 ++++++++++++++++++++ .github/fixtures/test-date-order/commit.sh | 15 +++++ .github/fixtures/test-date-order/expected.md | 10 ++++ .github/fixtures/test-topo-order/cliff.toml | 60 ++++++++++++++++++++ .github/fixtures/test-topo-order/commit.sh | 15 +++++ .github/fixtures/test-topo-order/expected.md | 10 ++++ .github/workflows/test-fixtures.yml | 8 ++- 7 files changed, 176 insertions(+), 2 deletions(-) create mode 100644 .github/fixtures/test-date-order/cliff.toml create mode 100755 .github/fixtures/test-date-order/commit.sh create mode 100644 .github/fixtures/test-date-order/expected.md create mode 100644 .github/fixtures/test-topo-order/cliff.toml create mode 100755 .github/fixtures/test-topo-order/commit.sh create mode 100644 .github/fixtures/test-topo-order/expected.md diff --git a/.github/fixtures/test-date-order/cliff.toml b/.github/fixtures/test-date-order/cliff.toml new file mode 100644 index 0000000000..b52d38ff54 --- /dev/null +++ b/.github/fixtures/test-date-order/cliff.toml @@ -0,0 +1,60 @@ +# configuration file for git-cliff (0.1.0) + +[changelog] +# changelog header +header = """ +# Changelog +All notable changes to this project will be documented in this file.\n +""" +# template for the changelog body +# https://tera.netlify.app/docs/#introduction +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} +{% else %}\ + ## [unreleased] +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %} + ### {{ group | upper_first }} + {% for commit in commits %} + - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\ + {% endfor %} +{% endfor %}\n +""" +# remove the leading and trailing whitespaces from the template +trim = true +# changelog footer +footer = """ + +""" + +[git] +# parse the commits based on https://www.conventionalcommits.org +conventional_commits = true +# filter out the commits that are not conventional +filter_unconventional = true +# 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\\(release\\): prepare for", skip = true}, + { message = "^chore", group = "Miscellaneous Tasks"}, + { body = ".*security", group = "Security"}, +] +# filter out the commits that are not matched by commit parsers +filter_commits = false +# glob pattern for matching git tags +tag_pattern = "v[0-9]*" +# regex for skipping tags +skip_tags = "v0.1.0-beta.1" +# regex for ignoring tags +ignore_tags = "" +# sort the tags chronologically +date_order = true +# sort the commits inside sections by oldest/newest order +sort_commits = "oldest" diff --git a/.github/fixtures/test-date-order/commit.sh b/.github/fixtures/test-date-order/commit.sh new file mode 100755 index 0000000000..4245174ea5 --- /dev/null +++ b/.github/fixtures/test-date-order/commit.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -e + +git commit --allow-empty -m "feat: add feature 1" +git tag v0.1.0 +sleep 1 + +git commit --allow-empty -m "feat: add feature 2" +git tag v0.2.0 +sleep 1 + +git checkout v0.1.0 +git commit --allow-empty -m "feat: fix feature 1" +git tag v0.1.1 +sleep 1 diff --git a/.github/fixtures/test-date-order/expected.md b/.github/fixtures/test-date-order/expected.md new file mode 100644 index 0000000000..f837e9941f --- /dev/null +++ b/.github/fixtures/test-date-order/expected.md @@ -0,0 +1,10 @@ +# Changelog +All notable changes to this project will be documented in this file. + +## [0.1.1] - 2021-01-23 + +### Features + +- Fix feature 1 + + diff --git a/.github/fixtures/test-topo-order/cliff.toml b/.github/fixtures/test-topo-order/cliff.toml new file mode 100644 index 0000000000..60437d5534 --- /dev/null +++ b/.github/fixtures/test-topo-order/cliff.toml @@ -0,0 +1,60 @@ +# configuration file for git-cliff (0.1.0) + +[changelog] +# changelog header +header = """ +# Changelog +All notable changes to this project will be documented in this file.\n +""" +# template for the changelog body +# https://tera.netlify.app/docs/#introduction +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} +{% else %}\ + ## [unreleased] +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %} + ### {{ group | upper_first }} + {% for commit in commits %} + - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\ + {% endfor %} +{% endfor %}\n +""" +# remove the leading and trailing whitespaces from the template +trim = true +# changelog footer +footer = """ + +""" + +[git] +# parse the commits based on https://www.conventionalcommits.org +conventional_commits = true +# filter out the commits that are not conventional +filter_unconventional = true +# 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\\(release\\): prepare for", skip = true}, + { message = "^chore", group = "Miscellaneous Tasks"}, + { body = ".*security", group = "Security"}, +] +# filter out the commits that are not matched by commit parsers +filter_commits = false +# glob pattern for matching git tags +tag_pattern = "v[0-9]*" +# regex for skipping tags +skip_tags = "v0.1.0-beta.1" +# regex for ignoring tags +ignore_tags = "" +# sort the tags chronologically +date_order = false +# sort the commits inside sections by oldest/newest order +sort_commits = "oldest" diff --git a/.github/fixtures/test-topo-order/commit.sh b/.github/fixtures/test-topo-order/commit.sh new file mode 100755 index 0000000000..4245174ea5 --- /dev/null +++ b/.github/fixtures/test-topo-order/commit.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -e + +git commit --allow-empty -m "feat: add feature 1" +git tag v0.1.0 +sleep 1 + +git commit --allow-empty -m "feat: add feature 2" +git tag v0.2.0 +sleep 1 + +git checkout v0.1.0 +git commit --allow-empty -m "feat: fix feature 1" +git tag v0.1.1 +sleep 1 diff --git a/.github/fixtures/test-topo-order/expected.md b/.github/fixtures/test-topo-order/expected.md new file mode 100644 index 0000000000..1adedaa416 --- /dev/null +++ b/.github/fixtures/test-topo-order/expected.md @@ -0,0 +1,10 @@ +# Changelog +All notable changes to this project will be documented in this file. + +## [0.2.0] - 2021-01-23 + +### Features + +- Add feature 2 + + diff --git a/.github/workflows/test-fixtures.yml b/.github/workflows/test-fixtures.yml index 61f8742a3b..a6f7374f2f 100644 --- a/.github/workflows/test-fixtures.yml +++ b/.github/workflows/test-fixtures.yml @@ -16,8 +16,12 @@ jobs: strategy: fail-fast: false matrix: - fixtures-name: - - test-ignore-tags + include: + - fixtures-name: test-ignore-tags + - fixtures-name: test-topo-order + command: --latest + - fixtures-name: test-date-order + command: --latest steps: - name: Checkout uses: actions/checkout@v2 From 8477d5176cb4e2984305a13000a47536ddc411ec Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Sun, 6 Feb 2022 05:27:41 +0900 Subject: [PATCH 04/19] remove unnecessary checkout Signed-off-by: Kenji Miyake --- .github/actions/run-fixtures-test/action.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/actions/run-fixtures-test/action.yml b/.github/actions/run-fixtures-test/action.yml index 52bbdcaa1b..2d666f9a3b 100644 --- a/.github/actions/run-fixtures-test/action.yml +++ b/.github/actions/run-fixtures-test/action.yml @@ -13,9 +13,6 @@ inputs: runs: using: composite steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set git config run: | git config --global user.name github-actions From 2072a18d36000ce95701e6c432a5d96a99037c1f Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Sun, 6 Feb 2022 05:30:46 +0900 Subject: [PATCH 05/19] remove cargo run Signed-off-by: Kenji Miyake --- .github/actions/run-fixtures-test/action.yml | 14 +++++++++++++- .github/workflows/test-fixtures.yml | 1 - 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/actions/run-fixtures-test/action.yml b/.github/actions/run-fixtures-test/action.yml index 2d666f9a3b..785d33d003 100644 --- a/.github/actions/run-fixtures-test/action.yml +++ b/.github/actions/run-fixtures-test/action.yml @@ -13,6 +13,18 @@ inputs: runs: using: composite steps: + - name: Install toolchain + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + + - name: Install git-cliff + run: | + cargo install --path git-cliff/ + shell: bash + - name: Set git config run: | git config --global user.name github-actions @@ -32,7 +44,7 @@ runs: - name: Generate a changelog working-directory: ${{ inputs.fixtures-dir }} run: | - cargo run -- --config cliff.toml ${{ inputs.command }} > output.md + git cliff --config cliff.toml ${{ inputs.command }} > output.md shell: bash - name: Compare the output with the expected output diff --git a/.github/workflows/test-fixtures.yml b/.github/workflows/test-fixtures.yml index a6f7374f2f..f89dab5d4f 100644 --- a/.github/workflows/test-fixtures.yml +++ b/.github/workflows/test-fixtures.yml @@ -12,7 +12,6 @@ jobs: test-fixtures: name: Test fixtures runs-on: ubuntu-latest - container: rust:latest strategy: fail-fast: false matrix: From 443525cb0289cb046a28e6c73136417be159138e Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Sun, 6 Feb 2022 05:44:55 +0900 Subject: [PATCH 06/19] set GIT_COMMITTER_DATE for each commit Signed-off-by: Kenji Miyake --- .github/actions/run-fixtures-test/action.yml | 3 --- .github/fixtures/test-date-order/commit.sh | 9 +++------ .github/fixtures/test-ignore-tags/commit.sh | 10 +++++----- .github/fixtures/test-topo-order/commit.sh | 9 +++------ 4 files changed, 11 insertions(+), 20 deletions(-) diff --git a/.github/actions/run-fixtures-test/action.yml b/.github/actions/run-fixtures-test/action.yml index 785d33d003..3a33f60490 100644 --- a/.github/actions/run-fixtures-test/action.yml +++ b/.github/actions/run-fixtures-test/action.yml @@ -36,9 +36,6 @@ runs: run: | git init ./commit.sh - env: - GIT_AUTHOR_DATE: "2021-01-23 01:23:45" - GIT_COMMITTER_DATE: "2021-01-23 01:23:45" shell: bash - name: Generate a changelog diff --git a/.github/fixtures/test-date-order/commit.sh b/.github/fixtures/test-date-order/commit.sh index 4245174ea5..9ce4935ad5 100755 --- a/.github/fixtures/test-date-order/commit.sh +++ b/.github/fixtures/test-date-order/commit.sh @@ -1,15 +1,12 @@ #!/usr/bin/env bash set -e -git commit --allow-empty -m "feat: add feature 1" +GIT_COMMITTER_DATE="2021-01-23 01:23:45" git commit --allow-empty -m "feat: add feature 1" git tag v0.1.0 -sleep 1 -git commit --allow-empty -m "feat: add feature 2" +GIT_COMMITTER_DATE="2021-01-23 01:23:46" git commit --allow-empty -m "feat: add feature 2" git tag v0.2.0 -sleep 1 git checkout v0.1.0 -git commit --allow-empty -m "feat: fix feature 1" +GIT_COMMITTER_DATE="2021-01-23 01:23:47" git commit --allow-empty -m "feat: fix feature 1" git tag v0.1.1 -sleep 1 diff --git a/.github/fixtures/test-ignore-tags/commit.sh b/.github/fixtures/test-ignore-tags/commit.sh index 07b7e8d211..7ffb277ebb 100755 --- a/.github/fixtures/test-ignore-tags/commit.sh +++ b/.github/fixtures/test-ignore-tags/commit.sh @@ -1,15 +1,15 @@ #!/usr/bin/env bash set -e -git commit --allow-empty -m "feat: add skip feature" +GIT_COMMITTER_DATE="2021-01-23 01:23:45" git commit --allow-empty -m "feat: add skip feature" git tag v0.1.0-beta.1 -git commit --allow-empty -m "feat: add feature 1" -git commit --allow-empty -m "feat: fix feature 1" +GIT_COMMITTER_DATE="2021-01-23 01:23:46" git commit --allow-empty -m "feat: add feature 1" +GIT_COMMITTER_DATE="2021-01-23 01:23:47" git commit --allow-empty -m "feat: fix feature 1" git tag v0.1.0 -git commit --allow-empty -m "feat: add feature 2" +GIT_COMMITTER_DATE="2021-01-23 01:23:48" git commit --allow-empty -m "feat: add feature 2" git tag v0.2.0-beta.1 -git commit --allow-empty -m "feat: add feature 3" +GIT_COMMITTER_DATE="2021-01-23 01:23:49" git commit --allow-empty -m "feat: add feature 3" git tag v0.2.0 \ No newline at end of file diff --git a/.github/fixtures/test-topo-order/commit.sh b/.github/fixtures/test-topo-order/commit.sh index 4245174ea5..9ce4935ad5 100755 --- a/.github/fixtures/test-topo-order/commit.sh +++ b/.github/fixtures/test-topo-order/commit.sh @@ -1,15 +1,12 @@ #!/usr/bin/env bash set -e -git commit --allow-empty -m "feat: add feature 1" +GIT_COMMITTER_DATE="2021-01-23 01:23:45" git commit --allow-empty -m "feat: add feature 1" git tag v0.1.0 -sleep 1 -git commit --allow-empty -m "feat: add feature 2" +GIT_COMMITTER_DATE="2021-01-23 01:23:46" git commit --allow-empty -m "feat: add feature 2" git tag v0.2.0 -sleep 1 git checkout v0.1.0 -git commit --allow-empty -m "feat: fix feature 1" +GIT_COMMITTER_DATE="2021-01-23 01:23:47" git commit --allow-empty -m "feat: fix feature 1" git tag v0.1.1 -sleep 1 From 4c382854869471053105c283843232af83837abd Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Sun, 6 Feb 2022 05:46:14 +0900 Subject: [PATCH 07/19] add a test for --date-order arg Signed-off-by: Kenji Miyake --- .../fixtures/test-date-order-arg/cliff.toml | 60 +++++++++++++++++++ .../fixtures/test-date-order-arg/commit.sh | 12 ++++ .../fixtures/test-date-order-arg/expected.md | 10 ++++ .github/workflows/test-fixtures.yml | 2 + 4 files changed, 84 insertions(+) create mode 100644 .github/fixtures/test-date-order-arg/cliff.toml create mode 100755 .github/fixtures/test-date-order-arg/commit.sh create mode 100644 .github/fixtures/test-date-order-arg/expected.md diff --git a/.github/fixtures/test-date-order-arg/cliff.toml b/.github/fixtures/test-date-order-arg/cliff.toml new file mode 100644 index 0000000000..60437d5534 --- /dev/null +++ b/.github/fixtures/test-date-order-arg/cliff.toml @@ -0,0 +1,60 @@ +# configuration file for git-cliff (0.1.0) + +[changelog] +# changelog header +header = """ +# Changelog +All notable changes to this project will be documented in this file.\n +""" +# template for the changelog body +# https://tera.netlify.app/docs/#introduction +body = """ +{% if version %}\ + ## [{{ version | trim_start_matches(pat="v") }}] - {{ timestamp | date(format="%Y-%m-%d") }} +{% else %}\ + ## [unreleased] +{% endif %}\ +{% for group, commits in commits | group_by(attribute="group") %} + ### {{ group | upper_first }} + {% for commit in commits %} + - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\ + {% endfor %} +{% endfor %}\n +""" +# remove the leading and trailing whitespaces from the template +trim = true +# changelog footer +footer = """ + +""" + +[git] +# parse the commits based on https://www.conventionalcommits.org +conventional_commits = true +# filter out the commits that are not conventional +filter_unconventional = true +# 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\\(release\\): prepare for", skip = true}, + { message = "^chore", group = "Miscellaneous Tasks"}, + { body = ".*security", group = "Security"}, +] +# filter out the commits that are not matched by commit parsers +filter_commits = false +# glob pattern for matching git tags +tag_pattern = "v[0-9]*" +# regex for skipping tags +skip_tags = "v0.1.0-beta.1" +# regex for ignoring tags +ignore_tags = "" +# sort the tags chronologically +date_order = false +# sort the commits inside sections by oldest/newest order +sort_commits = "oldest" diff --git a/.github/fixtures/test-date-order-arg/commit.sh b/.github/fixtures/test-date-order-arg/commit.sh new file mode 100755 index 0000000000..9ce4935ad5 --- /dev/null +++ b/.github/fixtures/test-date-order-arg/commit.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -e + +GIT_COMMITTER_DATE="2021-01-23 01:23:45" git commit --allow-empty -m "feat: add feature 1" +git tag v0.1.0 + +GIT_COMMITTER_DATE="2021-01-23 01:23:46" git commit --allow-empty -m "feat: add feature 2" +git tag v0.2.0 + +git checkout v0.1.0 +GIT_COMMITTER_DATE="2021-01-23 01:23:47" git commit --allow-empty -m "feat: fix feature 1" +git tag v0.1.1 diff --git a/.github/fixtures/test-date-order-arg/expected.md b/.github/fixtures/test-date-order-arg/expected.md new file mode 100644 index 0000000000..f837e9941f --- /dev/null +++ b/.github/fixtures/test-date-order-arg/expected.md @@ -0,0 +1,10 @@ +# Changelog +All notable changes to this project will be documented in this file. + +## [0.1.1] - 2021-01-23 + +### Features + +- Fix feature 1 + + diff --git a/.github/workflows/test-fixtures.yml b/.github/workflows/test-fixtures.yml index f89dab5d4f..609a2e56d8 100644 --- a/.github/workflows/test-fixtures.yml +++ b/.github/workflows/test-fixtures.yml @@ -21,6 +21,8 @@ jobs: command: --latest - fixtures-name: test-date-order command: --latest + - fixtures-name: test-date-order-arg + command: --latest --date-order steps: - name: Checkout uses: actions/checkout@v2 From cbb0fa8a3c75b655161050e4f990fac962394a26 Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Mon, 7 Feb 2022 12:31:08 +0900 Subject: [PATCH 08/19] fix git config style Signed-off-by: Kenji Miyake --- .github/actions/run-fixtures-test/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/run-fixtures-test/action.yml b/.github/actions/run-fixtures-test/action.yml index 3a33f60490..31a169db2c 100644 --- a/.github/actions/run-fixtures-test/action.yml +++ b/.github/actions/run-fixtures-test/action.yml @@ -27,8 +27,8 @@ runs: - name: Set git config run: | - git config --global user.name github-actions - git config --global user.email github-actions@github.com + git config user.name 'github-actions[bot]' + git config user.email 'github-actions[bot]@users.noreply.github.com' shell: bash - name: Create commits and tags From 2acc83cd527383f9a4b74a20c2cecb7d9ed7683c Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Mon, 7 Feb 2022 13:15:23 +0900 Subject: [PATCH 09/19] remove an unnecessary period Signed-off-by: Kenji Miyake --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b1293c5434..e9a3e1779c 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ git-cliff [FLAGS] [OPTIONS] [--] [RANGE] -l, --latest Processes the commits starting from the latest tag --current Processes the commits that belong to the current tag -u, --unreleased Processes the commits that do not belong to a tag - --date-order Sorts the tags chronologically. + --date-order Sorts the tags chronologically -h, --help Prints help information -V, --version Prints version information ``` From 7f905fdea9f9ef6721a5d6f947a1bd51eee68dd4 Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Mon, 7 Feb 2022 13:15:28 +0900 Subject: [PATCH 10/19] apply #60 Signed-off-by: Kenji Miyake --- .github/fixtures/test-date-order-arg/cliff.toml | 4 ++-- .github/fixtures/test-date-order/cliff.toml | 4 ++-- .github/fixtures/test-topo-order/cliff.toml | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/fixtures/test-date-order-arg/cliff.toml b/.github/fixtures/test-date-order-arg/cliff.toml index 60437d5534..7a85fd1d6f 100644 --- a/.github/fixtures/test-date-order-arg/cliff.toml +++ b/.github/fixtures/test-date-order-arg/cliff.toml @@ -3,7 +3,7 @@ [changelog] # changelog header header = """ -# Changelog +# Changelog\n All notable changes to this project will be documented in this file.\n """ # template for the changelog body @@ -21,7 +21,7 @@ body = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespaces from the template +# remove the leading and trailing whitespace from the template trim = true # changelog footer footer = """ diff --git a/.github/fixtures/test-date-order/cliff.toml b/.github/fixtures/test-date-order/cliff.toml index b52d38ff54..5a21b13130 100644 --- a/.github/fixtures/test-date-order/cliff.toml +++ b/.github/fixtures/test-date-order/cliff.toml @@ -3,7 +3,7 @@ [changelog] # changelog header header = """ -# Changelog +# Changelog\n All notable changes to this project will be documented in this file.\n """ # template for the changelog body @@ -21,7 +21,7 @@ body = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespaces from the template +# remove the leading and trailing whitespace from the template trim = true # changelog footer footer = """ diff --git a/.github/fixtures/test-topo-order/cliff.toml b/.github/fixtures/test-topo-order/cliff.toml index 60437d5534..9c6543231e 100644 --- a/.github/fixtures/test-topo-order/cliff.toml +++ b/.github/fixtures/test-topo-order/cliff.toml @@ -21,7 +21,7 @@ body = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespaces from the template +# remove the leading and trailing whitespace from the template trim = true # changelog footer footer = """ From 9d8e92608d9234b354b88b2e6f354ea9edd47744 Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Mon, 7 Feb 2022 13:28:06 +0900 Subject: [PATCH 11/19] minify the config files for tests Signed-off-by: Kenji Miyake --- .../fixtures/test-date-order-arg/cliff.toml | 39 ------------------ .github/fixtures/test-date-order/cliff.toml | 36 ---------------- .github/fixtures/test-ignore-tags/cliff.toml | 34 +-------------- .github/fixtures/test-topo-order/cliff.toml | 41 +------------------ 4 files changed, 2 insertions(+), 148 deletions(-) diff --git a/.github/fixtures/test-date-order-arg/cliff.toml b/.github/fixtures/test-date-order-arg/cliff.toml index 7a85fd1d6f..e45d8747af 100644 --- a/.github/fixtures/test-date-order-arg/cliff.toml +++ b/.github/fixtures/test-date-order-arg/cliff.toml @@ -1,5 +1,3 @@ -# configuration file for git-cliff (0.1.0) - [changelog] # changelog header header = """ @@ -21,40 +19,3 @@ body = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true -# changelog footer -footer = """ - -""" - -[git] -# parse the commits based on https://www.conventionalcommits.org -conventional_commits = true -# filter out the commits that are not conventional -filter_unconventional = true -# 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\\(release\\): prepare for", skip = true}, - { message = "^chore", group = "Miscellaneous Tasks"}, - { body = ".*security", group = "Security"}, -] -# filter out the commits that are not matched by commit parsers -filter_commits = false -# glob pattern for matching git tags -tag_pattern = "v[0-9]*" -# regex for skipping tags -skip_tags = "v0.1.0-beta.1" -# regex for ignoring tags -ignore_tags = "" -# sort the tags chronologically -date_order = false -# sort the commits inside sections by oldest/newest order -sort_commits = "oldest" diff --git a/.github/fixtures/test-date-order/cliff.toml b/.github/fixtures/test-date-order/cliff.toml index 5a21b13130..b72d39598f 100644 --- a/.github/fixtures/test-date-order/cliff.toml +++ b/.github/fixtures/test-date-order/cliff.toml @@ -1,5 +1,3 @@ -# configuration file for git-cliff (0.1.0) - [changelog] # changelog header header = """ @@ -21,40 +19,6 @@ body = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true -# changelog footer -footer = """ - -""" [git] -# parse the commits based on https://www.conventionalcommits.org -conventional_commits = true -# filter out the commits that are not conventional -filter_unconventional = true -# 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\\(release\\): prepare for", skip = true}, - { message = "^chore", group = "Miscellaneous Tasks"}, - { body = ".*security", group = "Security"}, -] -# filter out the commits that are not matched by commit parsers -filter_commits = false -# glob pattern for matching git tags -tag_pattern = "v[0-9]*" -# regex for skipping tags -skip_tags = "v0.1.0-beta.1" -# regex for ignoring tags -ignore_tags = "" -# sort the tags chronologically date_order = true -# sort the commits inside sections by oldest/newest order -sort_commits = "oldest" diff --git a/.github/fixtures/test-ignore-tags/cliff.toml b/.github/fixtures/test-ignore-tags/cliff.toml index 68bf27d9a9..62a625bf23 100644 --- a/.github/fixtures/test-ignore-tags/cliff.toml +++ b/.github/fixtures/test-ignore-tags/cliff.toml @@ -1,5 +1,3 @@ -# configuration file for git-cliff (0.1.0) - [changelog] # changelog header header = """ @@ -17,43 +15,13 @@ body = """ {% for group, commits in commits | group_by(attribute="group") %} ### {{ group | upper_first }} {% for commit in commits %} - - {{ commit.message | upper_first }}\ + - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true -# changelog footer -footer = """ - -""" [git] -# allow only conventional commits -# https://www.conventionalcommits.org -conventional_commits = true -# 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\\(release\\): prepare for", skip = true}, - { message = "^chore", group = "Miscellaneous Tasks"}, - { body = ".*security", group = "Security"}, -] -# filter out the commits that are not matched by commit parsers -filter_commits = false -# glob pattern for matching git tags -tag_pattern = "v[0-9]*" # regex for skipping tags skip_tags = "v0.1.0-beta.1" # regex for ignoring tags ignore_tags = "v.*-beta.*" -# sort the tags chronologically -date_order = false -# sort the commits inside sections by oldest/newest order -sort_commits = "oldest" diff --git a/.github/fixtures/test-topo-order/cliff.toml b/.github/fixtures/test-topo-order/cliff.toml index 9c6543231e..e45d8747af 100644 --- a/.github/fixtures/test-topo-order/cliff.toml +++ b/.github/fixtures/test-topo-order/cliff.toml @@ -1,9 +1,7 @@ -# configuration file for git-cliff (0.1.0) - [changelog] # changelog header header = """ -# Changelog +# Changelog\n All notable changes to this project will be documented in this file.\n """ # template for the changelog body @@ -21,40 +19,3 @@ body = """ {% endfor %} {% endfor %}\n """ -# remove the leading and trailing whitespace from the template -trim = true -# changelog footer -footer = """ - -""" - -[git] -# parse the commits based on https://www.conventionalcommits.org -conventional_commits = true -# filter out the commits that are not conventional -filter_unconventional = true -# 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\\(release\\): prepare for", skip = true}, - { message = "^chore", group = "Miscellaneous Tasks"}, - { body = ".*security", group = "Security"}, -] -# filter out the commits that are not matched by commit parsers -filter_commits = false -# glob pattern for matching git tags -tag_pattern = "v[0-9]*" -# regex for skipping tags -skip_tags = "v0.1.0-beta.1" -# regex for ignoring tags -ignore_tags = "" -# sort the tags chronologically -date_order = false -# sort the commits inside sections by oldest/newest order -sort_commits = "oldest" From 830eb11c92f2a3a48c2c04e82e72c80f2b687342 Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Mon, 7 Feb 2022 13:34:30 +0900 Subject: [PATCH 12/19] fix git config style Signed-off-by: Kenji Miyake --- .github/actions/run-fixtures-test/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/run-fixtures-test/action.yml b/.github/actions/run-fixtures-test/action.yml index 31a169db2c..bad27dd8e9 100644 --- a/.github/actions/run-fixtures-test/action.yml +++ b/.github/actions/run-fixtures-test/action.yml @@ -27,8 +27,8 @@ runs: - name: Set git config run: | - git config user.name 'github-actions[bot]' - git config user.email 'github-actions[bot]@users.noreply.github.com' + 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 From 4f81f63147231c6981efbebc82850b68cc4b83d0 Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Wed, 9 Feb 2022 01:14:50 +0900 Subject: [PATCH 13/19] fix styles of expected.md Signed-off-by: Kenji Miyake --- .github/fixtures/test-date-order-arg/expected.md | 3 ++- .github/fixtures/test-date-order/expected.md | 3 ++- .github/fixtures/test-ignore-tags/expected.md | 4 ++-- .github/fixtures/test-topo-order/expected.md | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/fixtures/test-date-order-arg/expected.md b/.github/fixtures/test-date-order-arg/expected.md index f837e9941f..dec0b23518 100644 --- a/.github/fixtures/test-date-order-arg/expected.md +++ b/.github/fixtures/test-date-order-arg/expected.md @@ -1,9 +1,10 @@ # Changelog + All notable changes to this project will be documented in this file. ## [0.1.1] - 2021-01-23 -### Features +### Feat - Fix feature 1 diff --git a/.github/fixtures/test-date-order/expected.md b/.github/fixtures/test-date-order/expected.md index f837e9941f..dec0b23518 100644 --- a/.github/fixtures/test-date-order/expected.md +++ b/.github/fixtures/test-date-order/expected.md @@ -1,9 +1,10 @@ # Changelog + All notable changes to this project will be documented in this file. ## [0.1.1] - 2021-01-23 -### Features +### Feat - Fix feature 1 diff --git a/.github/fixtures/test-ignore-tags/expected.md b/.github/fixtures/test-ignore-tags/expected.md index 2d96ad5707..740a172dd6 100644 --- a/.github/fixtures/test-ignore-tags/expected.md +++ b/.github/fixtures/test-ignore-tags/expected.md @@ -4,14 +4,14 @@ All notable changes to this project will be documented in this file. ## [0.2.0] - 2021-01-23 -### Features +### Feat - Add feature 2 - Add feature 3 ## [0.1.0] - 2021-01-23 -### Features +### Feat - Add feature 1 - Fix feature 1 diff --git a/.github/fixtures/test-topo-order/expected.md b/.github/fixtures/test-topo-order/expected.md index 1adedaa416..a041e603d2 100644 --- a/.github/fixtures/test-topo-order/expected.md +++ b/.github/fixtures/test-topo-order/expected.md @@ -1,9 +1,10 @@ # Changelog + All notable changes to this project will be documented in this file. ## [0.2.0] - 2021-01-23 -### Features +### Feat - Add feature 2 From 7c9616c70a817a8af922717134c31e7df3e50e08 Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Wed, 9 Feb 2022 01:15:47 +0900 Subject: [PATCH 14/19] make some steps one-line Signed-off-by: Kenji Miyake --- .github/actions/run-fixtures-test/action.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/actions/run-fixtures-test/action.yml b/.github/actions/run-fixtures-test/action.yml index bad27dd8e9..3d72daff1d 100644 --- a/.github/actions/run-fixtures-test/action.yml +++ b/.github/actions/run-fixtures-test/action.yml @@ -21,8 +21,7 @@ runs: override: true - name: Install git-cliff - run: | - cargo install --path git-cliff/ + run: cargo install --path git-cliff/ shell: bash - name: Set git config @@ -40,8 +39,7 @@ runs: - name: Generate a changelog working-directory: ${{ inputs.fixtures-dir }} - run: | - git cliff --config cliff.toml ${{ inputs.command }} > output.md + run: git cliff --config cliff.toml ${{ inputs.command }} > output.md shell: bash - name: Compare the output with the expected output From 3d334cc9efe49696fb741b4358ba5a6aa50bad3a Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Wed, 9 Feb 2022 01:22:08 +0900 Subject: [PATCH 15/19] remove footers Signed-off-by: Kenji Miyake --- .github/fixtures/test-date-order-arg/expected.md | 2 -- .github/fixtures/test-date-order/expected.md | 2 -- .github/fixtures/test-ignore-tags/expected.md | 2 -- .github/fixtures/test-topo-order/expected.md | 2 -- 4 files changed, 8 deletions(-) diff --git a/.github/fixtures/test-date-order-arg/expected.md b/.github/fixtures/test-date-order-arg/expected.md index dec0b23518..91bbe2d9f5 100644 --- a/.github/fixtures/test-date-order-arg/expected.md +++ b/.github/fixtures/test-date-order-arg/expected.md @@ -7,5 +7,3 @@ All notable changes to this project will be documented in this file. ### Feat - Fix feature 1 - - diff --git a/.github/fixtures/test-date-order/expected.md b/.github/fixtures/test-date-order/expected.md index dec0b23518..91bbe2d9f5 100644 --- a/.github/fixtures/test-date-order/expected.md +++ b/.github/fixtures/test-date-order/expected.md @@ -7,5 +7,3 @@ All notable changes to this project will be documented in this file. ### Feat - Fix feature 1 - - diff --git a/.github/fixtures/test-ignore-tags/expected.md b/.github/fixtures/test-ignore-tags/expected.md index 740a172dd6..e8d897d5da 100644 --- a/.github/fixtures/test-ignore-tags/expected.md +++ b/.github/fixtures/test-ignore-tags/expected.md @@ -15,5 +15,3 @@ All notable changes to this project will be documented in this file. - Add feature 1 - Fix feature 1 - - diff --git a/.github/fixtures/test-topo-order/expected.md b/.github/fixtures/test-topo-order/expected.md index a041e603d2..15a7bf8d80 100644 --- a/.github/fixtures/test-topo-order/expected.md +++ b/.github/fixtures/test-topo-order/expected.md @@ -7,5 +7,3 @@ All notable changes to this project will be documented in this file. ### Feat - Add feature 2 - - From 802881523f7a52d2bbfd0b4d87373ba8be8dcb5c Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Wed, 9 Feb 2022 01:29:47 +0900 Subject: [PATCH 16/19] remove newlines Signed-off-by: Kenji Miyake --- .github/fixtures/test-date-order-arg/cliff.toml | 2 +- .github/fixtures/test-date-order/cliff.toml | 2 +- .github/fixtures/test-ignore-tags/cliff.toml | 2 +- .github/fixtures/test-topo-order/cliff.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/fixtures/test-date-order-arg/cliff.toml b/.github/fixtures/test-date-order-arg/cliff.toml index e45d8747af..054bf152c3 100644 --- a/.github/fixtures/test-date-order-arg/cliff.toml +++ b/.github/fixtures/test-date-order-arg/cliff.toml @@ -17,5 +17,5 @@ body = """ {% for commit in commits %} - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\ {% endfor %} -{% endfor %}\n +{% endfor %} """ diff --git a/.github/fixtures/test-date-order/cliff.toml b/.github/fixtures/test-date-order/cliff.toml index b72d39598f..70b5a7984e 100644 --- a/.github/fixtures/test-date-order/cliff.toml +++ b/.github/fixtures/test-date-order/cliff.toml @@ -17,7 +17,7 @@ body = """ {% for commit in commits %} - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\ {% endfor %} -{% endfor %}\n +{% endfor %} """ [git] diff --git a/.github/fixtures/test-ignore-tags/cliff.toml b/.github/fixtures/test-ignore-tags/cliff.toml index 62a625bf23..ada8eab64a 100644 --- a/.github/fixtures/test-ignore-tags/cliff.toml +++ b/.github/fixtures/test-ignore-tags/cliff.toml @@ -17,7 +17,7 @@ body = """ {% for commit in commits %} - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\ {% endfor %} -{% endfor %}\n +{% endfor %} """ [git] diff --git a/.github/fixtures/test-topo-order/cliff.toml b/.github/fixtures/test-topo-order/cliff.toml index e45d8747af..054bf152c3 100644 --- a/.github/fixtures/test-topo-order/cliff.toml +++ b/.github/fixtures/test-topo-order/cliff.toml @@ -17,5 +17,5 @@ body = """ {% for commit in commits %} - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\ {% endfor %} -{% endfor %}\n +{% endfor %} """ From cbb6bbb158de151c5896fafebe83d5e027aa161a Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Wed, 9 Feb 2022 01:39:10 +0900 Subject: [PATCH 17/19] Revert "remove newlines" This reverts commit 802881523f7a52d2bbfd0b4d87373ba8be8dcb5c. --- .github/fixtures/test-date-order-arg/cliff.toml | 2 +- .github/fixtures/test-date-order/cliff.toml | 2 +- .github/fixtures/test-ignore-tags/cliff.toml | 2 +- .github/fixtures/test-topo-order/cliff.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/fixtures/test-date-order-arg/cliff.toml b/.github/fixtures/test-date-order-arg/cliff.toml index 054bf152c3..e45d8747af 100644 --- a/.github/fixtures/test-date-order-arg/cliff.toml +++ b/.github/fixtures/test-date-order-arg/cliff.toml @@ -17,5 +17,5 @@ body = """ {% for commit in commits %} - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\ {% endfor %} -{% endfor %} +{% endfor %}\n """ diff --git a/.github/fixtures/test-date-order/cliff.toml b/.github/fixtures/test-date-order/cliff.toml index 70b5a7984e..b72d39598f 100644 --- a/.github/fixtures/test-date-order/cliff.toml +++ b/.github/fixtures/test-date-order/cliff.toml @@ -17,7 +17,7 @@ body = """ {% for commit in commits %} - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\ {% endfor %} -{% endfor %} +{% endfor %}\n """ [git] diff --git a/.github/fixtures/test-ignore-tags/cliff.toml b/.github/fixtures/test-ignore-tags/cliff.toml index ada8eab64a..62a625bf23 100644 --- a/.github/fixtures/test-ignore-tags/cliff.toml +++ b/.github/fixtures/test-ignore-tags/cliff.toml @@ -17,7 +17,7 @@ body = """ {% for commit in commits %} - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\ {% endfor %} -{% endfor %} +{% endfor %}\n """ [git] diff --git a/.github/fixtures/test-topo-order/cliff.toml b/.github/fixtures/test-topo-order/cliff.toml index 054bf152c3..e45d8747af 100644 --- a/.github/fixtures/test-topo-order/cliff.toml +++ b/.github/fixtures/test-topo-order/cliff.toml @@ -17,5 +17,5 @@ body = """ {% for commit in commits %} - {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\ {% endfor %} -{% endfor %} +{% endfor %}\n """ From 182be874215a99a04423d7a1f771064ecefe2d66 Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Wed, 9 Feb 2022 01:39:21 +0900 Subject: [PATCH 18/19] Revert "remove footers" This reverts commit 3d334cc9efe49696fb741b4358ba5a6aa50bad3a. --- .github/fixtures/test-date-order-arg/expected.md | 2 ++ .github/fixtures/test-date-order/expected.md | 2 ++ .github/fixtures/test-ignore-tags/expected.md | 2 ++ .github/fixtures/test-topo-order/expected.md | 2 ++ 4 files changed, 8 insertions(+) diff --git a/.github/fixtures/test-date-order-arg/expected.md b/.github/fixtures/test-date-order-arg/expected.md index 91bbe2d9f5..dec0b23518 100644 --- a/.github/fixtures/test-date-order-arg/expected.md +++ b/.github/fixtures/test-date-order-arg/expected.md @@ -7,3 +7,5 @@ All notable changes to this project will be documented in this file. ### Feat - Fix feature 1 + + diff --git a/.github/fixtures/test-date-order/expected.md b/.github/fixtures/test-date-order/expected.md index 91bbe2d9f5..dec0b23518 100644 --- a/.github/fixtures/test-date-order/expected.md +++ b/.github/fixtures/test-date-order/expected.md @@ -7,3 +7,5 @@ All notable changes to this project will be documented in this file. ### Feat - Fix feature 1 + + diff --git a/.github/fixtures/test-ignore-tags/expected.md b/.github/fixtures/test-ignore-tags/expected.md index e8d897d5da..740a172dd6 100644 --- a/.github/fixtures/test-ignore-tags/expected.md +++ b/.github/fixtures/test-ignore-tags/expected.md @@ -15,3 +15,5 @@ All notable changes to this project will be documented in this file. - Add feature 1 - Fix feature 1 + + diff --git a/.github/fixtures/test-topo-order/expected.md b/.github/fixtures/test-topo-order/expected.md index 15a7bf8d80..a041e603d2 100644 --- a/.github/fixtures/test-topo-order/expected.md +++ b/.github/fixtures/test-topo-order/expected.md @@ -7,3 +7,5 @@ All notable changes to this project will be documented in this file. ### Feat - Add feature 2 + + From 543d2f89ffd2ec555b068b75f6dfee1843b60e43 Mon Sep 17 00:00:00 2001 From: Kenji Miyake Date: Wed, 9 Feb 2022 01:40:11 +0900 Subject: [PATCH 19/19] add trim and footer Signed-off-by: Kenji Miyake --- .github/fixtures/test-date-order-arg/cliff.toml | 6 ++++++ .github/fixtures/test-date-order/cliff.toml | 6 ++++++ .github/fixtures/test-ignore-tags/cliff.toml | 6 ++++++ .github/fixtures/test-topo-order/cliff.toml | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/.github/fixtures/test-date-order-arg/cliff.toml b/.github/fixtures/test-date-order-arg/cliff.toml index e45d8747af..b9f550ff50 100644 --- a/.github/fixtures/test-date-order-arg/cliff.toml +++ b/.github/fixtures/test-date-order-arg/cliff.toml @@ -19,3 +19,9 @@ body = """ {% endfor %} {% endfor %}\n """ +# remove the leading and trailing whitespace from the template +trim = true +# changelog footer +footer = """ + +""" diff --git a/.github/fixtures/test-date-order/cliff.toml b/.github/fixtures/test-date-order/cliff.toml index b72d39598f..0d3c8e58d7 100644 --- a/.github/fixtures/test-date-order/cliff.toml +++ b/.github/fixtures/test-date-order/cliff.toml @@ -19,6 +19,12 @@ body = """ {% endfor %} {% endfor %}\n """ +# remove the leading and trailing whitespace from the template +trim = true +# changelog footer +footer = """ + +""" [git] date_order = true diff --git a/.github/fixtures/test-ignore-tags/cliff.toml b/.github/fixtures/test-ignore-tags/cliff.toml index 62a625bf23..4f071c15e5 100644 --- a/.github/fixtures/test-ignore-tags/cliff.toml +++ b/.github/fixtures/test-ignore-tags/cliff.toml @@ -19,6 +19,12 @@ body = """ {% endfor %} {% endfor %}\n """ +# remove the leading and trailing whitespace from the template +trim = true +# changelog footer +footer = """ + +""" [git] # regex for skipping tags diff --git a/.github/fixtures/test-topo-order/cliff.toml b/.github/fixtures/test-topo-order/cliff.toml index e45d8747af..b9f550ff50 100644 --- a/.github/fixtures/test-topo-order/cliff.toml +++ b/.github/fixtures/test-topo-order/cliff.toml @@ -19,3 +19,9 @@ body = """ {% endfor %} {% endfor %}\n """ +# remove the leading and trailing whitespace from the template +trim = true +# changelog footer +footer = """ + +"""