Skip to content
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

Permit merge commit messages #10

Open
danbernier opened this issue Sep 20, 2022 · 1 comment
Open

Permit merge commit messages #10

danbernier opened this issue Sep 20, 2022 · 1 comment

Comments

@danbernier
Copy link

commitlint fails auto-generated merge-commit messages; these should be allowed.

daniel@cracked project_dir % git merge develop

→ input: "Merge branch 'develop'..."

Errors:
  ❌ parser: type: invalid character ' '

Total 1 errors, 0 warnings, 0 other severities
Not committing merge; use 'git commit' to complete the merge.
@gaurav5430
Copy link

A proper solution would be to have a defaultIgnore + ignore rule as it exists here https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/is-ignored/src/defaults.ts

for now i have added this to my commit-msg file

#!/bin/sh
if ! type commitlint >/dev/null 2>/dev/null; then
	echo ""
    echo "commitlint could not be found"
    echo "try again after installing commitlint or add commitlint to PATH"
	echo ""
    exit 2;
fi

commit_message_file=$(git rev-parse --git-dir)/COMMIT_EDITMSG

# Read the content of the commit message file
commit_message=$(cat "$commit_message_file")

# Check if the commit message starts with "merge"
if [[ "$commit_message" =~ ^merge ]]; then
  # If it starts with "merge", exit without performing validation
  exit 0
fi

commitlint lint --message $1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants