Compare commits

..

1 Commits

Author SHA1 Message Date
6e025107cb chore: setup commitlint and git hooks
Some checks failed
Commit Message Check / conventional-commits (pull_request) Failing after 0s
Deploy monie-backend to dev (kaniko) / build-and-deploy (pull_request) Successful in 0s
Deploy monie-backend (kaniko) / build-and-deploy (pull_request) Successful in 0s
2026-04-05 00:21:34 +03:00

View File

@@ -10,21 +10,7 @@ jobs:
runs-on: [self-hosted, linux]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Validate commit messages with commitlint
- name: Validate commit messages
env:
EVENT_NAME: ${{ github.event_name }}
BEFORE_SHA: ${{ github.event.before }}
@@ -63,7 +49,38 @@ jobs:
fi
if [ -n "${BASE_SHA}" ] && [ "${BASE_SHA}" != "${TARGET_SHA}" ]; then
npx --no -- commitlint --from "${BASE_SHA}" --to "${TARGET_SHA}" --verbose
MESSAGES="$(git log --format=%s "${BASE_SHA}..${TARGET_SHA}")"
else
git log -1 --format=%s "${TARGET_SHA}" | npx --no -- commitlint --verbose
MESSAGES="$(git log -1 --format=%s "${TARGET_SHA}")"
fi
if [ -z "${MESSAGES}" ]; then
MESSAGES="$(git log -1 --format=%s "${TARGET_SHA}")"
fi
PATTERN='^(build|chore|ci|docs|feat|fix|perf|refactor|style|test)(\([a-z0-9._/-]+\))?(!)?: .+'
FAILED=0
while IFS= read -r SUBJECT; do
[ -z "${SUBJECT}" ] && continue
if [[ "${SUBJECT}" =~ ^Merge[[:space:]] ]]; then
continue
fi
if [[ "${SUBJECT}" =~ ^Revert[[:space:]] ]]; then
continue
fi
if [[ ! "${SUBJECT}" =~ ${PATTERN} ]]; then
echo "Invalid commit message: ${SUBJECT}"
FAILED=1
else
echo "OK: ${SUBJECT}"
fi
done <<< "${MESSAGES}"
if [ "${FAILED}" -ne 0 ]; then
echo "Conventional Commit check failed."
exit 1
fi