Automated commit detection #20
@@ -86,6 +86,9 @@ if ! [[ "$HEADER" =~ $HEADER_REGEX ]]; then
|
|||||||
error_exit "Invalid header format.\n\nHeader must be in the format: <type>: <short description>\nAllowed types: ${ALLOWED_TYPES[*]}\nExample: feat: add new user authentication feature"
|
error_exit "Invalid header format.\n\nHeader must be in the format: <type>: <short description>\nAllowed types: ${ALLOWED_TYPES[*]}\nExample: feat: add new user authentication feature"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Only validate footer if commit type is not chore
|
||||||
|
TYPE=$(echo "$HEADER" | cut -d':' -f1)
|
||||||
|
if [ "$TYPE" != "chore" ]; then
|
||||||
# 3. Validate the footer (last line) of the commit message
|
# 3. Validate the footer (last line) of the commit message
|
||||||
FOOTER=$(tail -n 1 "$COMMIT_MSG_FILE")
|
FOOTER=$(tail -n 1 "$COMMIT_MSG_FILE")
|
||||||
|
|
||||||
@@ -101,6 +104,7 @@ FOOTER_REGEX="^(ref|close): N25B-[0-9]+$"
|
|||||||
if ! [[ "$FOOTER" =~ $FOOTER_REGEX ]]; then
|
if ! [[ "$FOOTER" =~ $FOOTER_REGEX ]]; then
|
||||||
error_exit "Invalid footer format.\n\nFooter must be in the format: [ref/close]: <issue identifier>\nExample: ref: N25B-123"
|
error_exit "Invalid footer format.\n\nFooter must be in the format: [ref/close]: <issue identifier>\nExample: ref: N25B-123"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# 4. If the message has more than 2 lines, validate the separator
|
# 4. If the message has more than 2 lines, validate the separator
|
||||||
# A blank line must exist between the header and the body.
|
# A blank line must exist between the header and the body.
|
||||||
|
|||||||
Reference in New Issue
Block a user