-
-
Notifications
You must be signed in to change notification settings - Fork 206
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(changelog, config)!: replace --topo-order by --date-order (#58)
* feat(changelog, config)!: replace --topo-order by --date-order Signed-off-by: Kenji Miyake <[email protected]> * ci: simplify test-fixtures workflow Signed-off-by: Kenji Miyake <[email protected]> * ci: add fixtures tests of topo_order and date_order Signed-off-by: Kenji Miyake <[email protected]> * remove unnecessary checkout Signed-off-by: Kenji Miyake <[email protected]> * remove cargo run Signed-off-by: Kenji Miyake <[email protected]> * set GIT_COMMITTER_DATE for each commit Signed-off-by: Kenji Miyake <[email protected]> * add a test for --date-order arg Signed-off-by: Kenji Miyake <[email protected]> * fix git config style Signed-off-by: Kenji Miyake <[email protected]> * remove an unnecessary period Signed-off-by: Kenji Miyake <[email protected]> * apply #60 Signed-off-by: Kenji Miyake <[email protected]> * minify the config files for tests Signed-off-by: Kenji Miyake <[email protected]> * fix git config style Signed-off-by: Kenji Miyake <[email protected]> * fix styles of expected.md Signed-off-by: Kenji Miyake <[email protected]> * make some steps one-line Signed-off-by: Kenji Miyake <[email protected]> * remove footers Signed-off-by: Kenji Miyake <[email protected]> * remove newlines Signed-off-by: Kenji Miyake <[email protected]> * Revert "remove newlines" This reverts commit 8028815. * Revert "remove footers" This reverts commit 3d334cc. * add trim and footer Signed-off-by: Kenji Miyake <[email protected]>
- Loading branch information
1 parent
0293b28
commit a3980f4
Showing
28 changed files
with
301 additions
and
127 deletions.
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
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: 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[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 }} | ||
run: | | ||
cat output.md | ||
diff --strip-trailing-cr output.md expected.md | ||
shell: bash |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[changelog] | ||
# changelog header | ||
header = """ | ||
# Changelog\n | ||
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 whitespace from the template | ||
trim = true | ||
# changelog footer | ||
footer = """ | ||
<!-- generated by git-cliff --> | ||
""" |
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 |
---|---|---|
@@ -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 |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
## [0.1.1] - 2021-01-23 | ||
|
||
### Feat | ||
|
||
- Fix feature 1 | ||
|
||
<!-- generated by git-cliff --> |
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
[changelog] | ||
# changelog header | ||
header = """ | ||
# Changelog\n | ||
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 whitespace from the template | ||
trim = true | ||
# changelog footer | ||
footer = """ | ||
<!-- generated by git-cliff --> | ||
""" | ||
|
||
[git] | ||
date_order = true |
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 |
---|---|---|
@@ -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 |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
## [0.1.1] - 2021-01-23 | ||
|
||
### Feat | ||
|
||
- Fix feature 1 | ||
|
||
<!-- generated by git-cliff --> |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[changelog] | ||
# changelog header | ||
header = """ | ||
# Changelog\n | ||
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 whitespace from the template | ||
trim = true | ||
# changelog footer | ||
footer = """ | ||
<!-- generated by git-cliff --> | ||
""" | ||
|
||
[git] | ||
# regex for skipping tags | ||
skip_tags = "v0.1.0-beta.1" | ||
# regex for ignoring tags | ||
ignore_tags = "v.*-beta.*" |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
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_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_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_COMMITTER_DATE="2021-01-23 01:23:49" git commit --allow-empty -m "feat: add feature 3" | ||
git tag v0.2.0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[changelog] | ||
# changelog header | ||
header = """ | ||
# Changelog\n | ||
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 whitespace from the template | ||
trim = true | ||
# changelog footer | ||
footer = """ | ||
<!-- generated by git-cliff --> | ||
""" |
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 |
---|---|---|
@@ -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 |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
|
||
## [0.2.0] - 2021-01-23 | ||
|
||
### Feat | ||
|
||
- Add feature 2 | ||
|
||
<!-- generated by git-cliff --> |
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 |
---|---|---|
|
@@ -12,41 +12,23 @@ jobs: | |
test-fixtures: | ||
name: Test fixtures | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- fixtures-name: test-ignore-tags | ||
- fixtures-name: test-topo-order | ||
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 | ||
|
||
- 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 [email protected] | ||
- 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 }} |
Oops, something went wrong.