diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e7e644d4e7..4f1577db7d 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -16,6 +16,8 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Check typos + uses: crate-ci/typos@master - name: Generate a changelog uses: orhun/git-cliff-action@main id: git-cliff diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b2ce3183a..98dbc402b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,15 @@ jobs: command: check args: --locked --no-default-features --verbose + typos: + name: Typos + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Check typos + uses: crate-ci/typos@master + test: name: Test suite runs-on: ubuntu-22.04 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f2fce8cae..ea15dfe543 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -739,7 +739,7 @@ All notable changes to this project will be documented in this file. - *(args)* Add `--output` argument - ([e0cda23](https://github.com/orhun/git-cliff/commit/e0cda238105e0ce22ac71409d6e3ee0e32a6bad7)) - *(args)* Add `--workdir` argument - ([de439be](https://github.com/orhun/git-cliff/commit/de439bef01e0e1209b8517ce7b241bb0db2cb530)) - *(changelog)* Support setting the body template via args - ([9fc08f4](https://github.com/orhun/git-cliff/commit/9fc08f4c50160374298bf77701ee5e299fa435a0)) -- *(logs)* Show the processsed commit message - ([45dccf7](https://github.com/orhun/git-cliff/commit/45dccf74a4a5449d92d453d21b6566acd8f30ebe)) +- *(logs)* Show the processed commit message - ([45dccf7](https://github.com/orhun/git-cliff/commit/45dccf74a4a5449d92d453d21b6566acd8f30ebe)) ### 🐛 Bug Fixes @@ -748,7 +748,7 @@ All notable changes to this project will be documented in this file. - *(cd)* Generate changelog on a dedicated/different job - ([2f16dd5](https://github.com/orhun/git-cliff/commit/2f16dd5ae7f4bbff7b9944db039192d8ce148655)) - *(cd)* Fix the syntax of publish step arguments - ([6414789](https://github.com/orhun/git-cliff/commit/6414789067780d0551292c004a8aaff04483906d)) - *(cd)* Use a separate step for setting the changelog body - ([f038054](https://github.com/orhun/git-cliff/commit/f038054417f608b5792b89f60b4d384b74b317dd)) -- *(cd)* Publish the cargo workspace members seperately - ([acc1d34](https://github.com/orhun/git-cliff/commit/acc1d3453ca865ddbf3e8e786fcc157c8e31eae6)) +- *(cd)* Publish the cargo workspace members separately - ([acc1d34](https://github.com/orhun/git-cliff/commit/acc1d3453ca865ddbf3e8e786fcc157c8e31eae6)) - *(cd)* Strip the changelog header before escaping - ([6b97c2d](https://github.com/orhun/git-cliff/commit/6b97c2d18c05fb9cf27088a39b24d12ab1b0c556)) - *(cd)* Use printf to prevent field splitting the variable - ([92a4b0d](https://github.com/orhun/git-cliff/commit/92a4b0d5bfb8c27627886005d0e6d823a3cc6476)) - *(cd)* Double quote the environment variable - ([85aa1cd](https://github.com/orhun/git-cliff/commit/85aa1cdc688b74d1d2df46dc61e6aa5561fc6ace)) @@ -810,7 +810,7 @@ All notable changes to this project will be documented in this file. - *(cargo)* Update project details - ([22f0a7e](https://github.com/orhun/git-cliff/commit/22f0a7ef73cb1649d9ed59e43ee0e410b456233d)) - *(cd)* Enable crates.io releases - ([31ecfd8](https://github.com/orhun/git-cliff/commit/31ecfd8ad041e36090575e5851ff00d491ccebca)) - *(cd)* Use only one step for uploading releases - ([42a714f](https://github.com/orhun/git-cliff/commit/42a714f31cf5b6f924fe68d966189e2c278a11a6)) -- *(cd)* Use seperate steps for uploading releases - ([0182533](https://github.com/orhun/git-cliff/commit/01825330d90a9399c9285b5a286b1d69aa1494e7)) +- *(cd)* Use separate steps for uploading releases - ([0182533](https://github.com/orhun/git-cliff/commit/01825330d90a9399c9285b5a286b1d69aa1494e7)) - *(cd)* Remove the custom changelog template - ([d826b9d](https://github.com/orhun/git-cliff/commit/d826b9d2e5bdd30b132731ff6d1dc87748543ccb)) - *(cd)* Override the changelog template - ([41053fb](https://github.com/orhun/git-cliff/commit/41053fbe90a08648b70e5cca6a2504e94202bd06)) - *(cd)* Set the release body on linux - ([7623977](https://github.com/orhun/git-cliff/commit/76239771662bf342d742c12907619eece1bf946d)) diff --git a/Cargo.lock b/Cargo.lock index 6044605d44..0261c1e339 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1726,18 +1726,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", diff --git a/Dockerfile b/Dockerfile index 3db4b846e1..19285b1b0b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,7 +27,7 @@ WORKDIR app # Even if the repository as marked as safe, GitHub Actions and some other # environments insist on running the entrypoint as root inside the container -# even when being run by a non priviledged user on their own files. Here we +# even when being run by a non privileged user on their own files. Here we # check the ownership of the workdir (which may or may not be /app) and change # our effective user/group ID to match. RUN cat <<'EOF' > /usr/local/bin/entrypoint.sh diff --git a/README.md b/README.md index b8ba7d3d2c..e9b9dbe38c 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Learn how to use **git-cliff** from the [documentation](https://git-cliff.org/do ## Editor Support -- [git-cliff.el](https://github.com/liuyinz/git-cliff.el) - Genarate, update and release changelog in Emacs +- [git-cliff.el](https://github.com/liuyinz/git-cliff.el) - Generate, update and release changelog in Emacs ## Similar/Related Projects diff --git a/cliff.toml b/cliff.toml index ee5d41daf7..2a5ffa3b35 100644 --- a/cliff.toml +++ b/cliff.toml @@ -65,6 +65,9 @@ split_commits = false # regex for preprocessing the commit messages commit_preprocessors = [ { pattern = '\((\w+\s)?#([0-9]+)\)', replace = "([#${2}](/issues/${2}))" }, + # Check spelling of the commit with https://github.com/crate-ci/typos + # If the spelling is incorrect, it will be automatically fixed. + { pattern = '.*', replace_command = 'typos --write-changes -' }, ] # regex for parsing and grouping commits commit_parsers = [ diff --git a/git-cliff-core/Cargo.toml b/git-cliff-core/Cargo.toml index 291825b375..0fc28fd58a 100644 --- a/git-cliff-core/Cargo.toml +++ b/git-cliff-core/Cargo.toml @@ -18,7 +18,7 @@ repo = ["dep:git2", "dep:glob", "dep:indexmap"] glob = { workspace = true, optional = true } regex.workspace = true log.workspace = true -thiserror = "1.0.49" +thiserror = "1.0.50" serde = { version = "1.0.189", features = ["derive"] } serde_json = "1.0.107" serde_regex = "1.1.0" diff --git a/git-cliff-core/src/command.rs b/git-cliff-core/src/command.rs index 3c68660507..c1048b4ac6 100644 --- a/git-cliff-core/src/command.rs +++ b/git-cliff-core/src/command.rs @@ -48,6 +48,12 @@ pub fn run( if output.status.success() { Ok(str::from_utf8(&output.stdout)?.to_string()) } else { + for output in [output.stdout, output.stderr] { + let output = str::from_utf8(&output)?.to_string(); + if !output.is_empty() { + log::error!("{}", output); + } + } Err(IoError::new( IoErrorKind::Other, format!("command exited with {:?}", output.status), diff --git a/release.sh b/release.sh index b1d8f52d38..efedc631cf 100755 --- a/release.sh +++ b/release.sh @@ -1,5 +1,9 @@ #!/usr/bin/env bash +if ! command -v typos &>/dev/null; then + echo "typos is not installed. Run 'cargo install typos' to install it, otherwise the typos won't be fixed" +fi + if [ -z "$1" ]; then echo "Please provide a tag." echo "Usage: ./release.sh v[X.Y.Z]" diff --git a/typos.toml b/typos.toml new file mode 100644 index 0000000000..dce75254eb --- /dev/null +++ b/typos.toml @@ -0,0 +1,5 @@ +[type.md] +extend-ignore-re = [ + "\\[[[:xdigit:]]{7}\\]\\(https://github.com/orhun/git-cliff/commit/[[:xdigit:]]{40}\\)", + "\\[halp\\]\\(https://github.com/orhun/halp\\)", +] diff --git a/website/docs/templating/context.md b/website/docs/templating/context.md index ad0a4dc441..9ba2daa890 100644 --- a/website/docs/templating/context.md +++ b/website/docs/templating/context.md @@ -27,7 +27,7 @@ following context is generated to use for templating: "commits": [ { "id": "e795460c9bb7275294d1fa53a9d73258fb51eb10", - "group": " (overrided by commit_parsers)", + "group": " (overridden by commit_parsers)", "scope": "[scope]", "message": "", "body": "[body]", @@ -124,8 +124,8 @@ If [`conventional_commits`](/docs/configuration#conventional_commits) is set to "commits": [ { "id": "e795460c9bb7275294d1fa53a9d73258fb51eb10", - "group": "(overrided by commit_parsers)", - "scope": "(overrided by commit_parsers)", + "group": "(overridden by commit_parsers)", + "scope": "(overridden by commit_parsers)", "message": "(full commit message including description, footers, etc.)", "conventional": false, "links": [