From 5f4513d68f7fb5063f1d7b68684a8458ab44c728 Mon Sep 17 00:00:00 2001 From: "Shahar \"Dawn\" Or" Date: Fri, 25 Aug 2023 18:45:11 +0700 Subject: [PATCH] build: lint commit messages in ci using an action --- .github/workflows/ci.yml | 1 + Makefile.toml | 21 ++------------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58daabd..2da6646 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,7 @@ jobs: with: fetch-depth: 0 # for commit linting and semantic-release persist-credentials: false + - uses: webiny/action-conventional-commits@1 - run: rustup update - uses: actions/cache@v3 with: diff --git a/Makefile.toml b/Makefile.toml index 4a0c545..8e6a1d1 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -3,13 +3,12 @@ default_to_workspace = false [env] CARGO_TERM_COLOR = "always" -LINT_COMMIT_MSG_FROM_STDIN = "cargo bin conventional_commits_linter --allow-angular-type-only --from-stdin" [tasks.pre-commit] run_task = { name = ["test", "clippy", "doc", "check_fmt"], parallel = true } [tasks.ci_main] -run_task = { name = ["test", "clippy", "doc", "check_fmt", "lint_pr_commit_msgs"], parallel = true } +run_task = { name = ["test", "clippy", "doc", "check_fmt"], parallel = true } [tasks.ci_post] run_task = { name = ["no_untracked", "no_modified", "release"] } @@ -37,23 +36,7 @@ args = ["fmt", "--check"] script = ''' #!/usr/bin/env bash set -euxo pipefail -$LINT_COMMIT_MSG_FROM_STDIN -''' - -[tasks.lint_pr_commit_msgs] -condition = { env_true = ["GITHUB_BASE_REF"] } -script = ''' -#!/usr/bin/env bash -set -euxo pipefail -# workaround for https://gitlab.com/DeveloperC/conventional_commits_linter/-/issues/1 -commits=$(git rev-list --skip=1 origin/$GITHUB_BASE_REF..HEAD) -exit_code=0 -for commit in $commits; do - git show --no-patch --format=%B $commit | \ - $LINT_COMMIT_MSG_FROM_STDIN || \ - exit_code=1 -done -exit $exit_code +cargo bin conventional_commits_linter --allow-angular-type-only --from-stdin ''' [tasks.table_of_contents]