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

Add CI job to enforce conventional commits #1451

Merged
merged 1 commit into from
Dec 24, 2024

Conversation

fujiapple852
Copy link
Owner

Add a CI job to enforce conventional commits.

  • Add a new job conventional-commits to .github/workflows/ci.yml to enforce conventional commits using webiny/action-conventional-commits@v1.
  • Configure the job to run on every pull requests to the master branch.
  • Define the conventional commit types: feat, fix, chore, docs, style, refactor, test, build, and ci.

@fujiapple852 fujiapple852 force-pushed the add-conventional-commits-ci branch 3 times, most recently from 1161f16 to 871c473 Compare December 24, 2024 00:41
@c-git
Copy link
Collaborator

c-git commented Dec 24, 2024

This is interesting. I have a small commit-msg hook that I wrote when I started trying to get accustomed to it. Copied below for reference:

#!/bin/sh

regex="^(feat|fix|build|chore|ci|docs|style|refactor|perf|test|revert)(\[.+\])?: .+"

grep -E "$regex" "$1"
if [ $? != 0 ]
then
    echo "[error] Commit message doesn't appear to in the conventional commit format"
    echo "[info] expecting \"<type>[optional scope]: <description>\""
    echo "[info] see https://www.conventionalcommits.org/en/v1.0.0/#summary for more info"
    echo "[debug] using regex: \"$regex\""
    echo "[debug] on commit message:"
    cat "$1"
    exit 1
fi

.github/workflows/ci.yml Outdated Show resolved Hide resolved
@fujiapple852 fujiapple852 force-pushed the add-conventional-commits-ci branch from 871c473 to 3d71ec3 Compare December 24, 2024 08:17
@fujiapple852 fujiapple852 force-pushed the add-conventional-commits-ci branch from 3d71ec3 to b2de771 Compare December 24, 2024 08:19
@fujiapple852 fujiapple852 enabled auto-merge (rebase) December 24, 2024 08:19
@fujiapple852 fujiapple852 merged commit 1892ec4 into master Dec 24, 2024
21 checks passed
@fujiapple852 fujiapple852 deleted the add-conventional-commits-ci branch December 24, 2024 08:23
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

Successfully merging this pull request may close these issues.

2 participants