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

ci: Allow PR title to end with a capital letter #1291

Merged
merged 2 commits into from
Apr 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions tools/scripts/scripts_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,22 @@ TestReturnCode() {
readonly T1="./validate-conventional-style.sh"
TestReturnCode "${T1}" 2;
TestReturnCode "${T1} 'chore: This title has everything valid except that its too long'" 3;
TestReturnCode "${T1} 'bot Bump github.com/alternativesourcenetwork/defradb from 1.1.0.1.0.0 to 1.1.0.1.0.1'" 3;
TestReturnCode "${T1} 'chore: This title has more than one : colon'" 4;
TestReturnCode "${T1} 'chore This title has no colon'" 4;
TestReturnCode "${T1} 'bot Bump github.com/short/short from 1.2.3 to 1.2.4'" 4;
fredcarle marked this conversation as resolved.
Show resolved Hide resolved
TestReturnCode "${T1} 'feat: a'" 5;
TestReturnCode "${T1} 'feat: '" 5;
TestReturnCode "${T1} 'feat:'" 5;
TestReturnCode "${T1} 'feat:There is no space between label & desc.'" 6;
TestReturnCode "${T1} 'feat:there is no space between label & desc.'" 6;
TestReturnCode "${T1} 'ci: lowercase first character after label'" 7;
TestReturnCode "${T1} 'ci: Last character should not be period.'" 8;
TestReturnCode "${T1} 'ci: Last character is not lowercase alphabeT'" 8;
TestReturnCode "${T1} 'ci: Last character is a space '" 8;
TestReturnCode "${T1} 'ci: Last character is a \\\`tick\\\`'" 8;
TestReturnCode "${T1} 'bug: This is an invalid label'" 9;
TestReturnCode "${T1} 'ci: Last character is a number v1.5.0'" 0;
TestReturnCode "${T1} 'ci: Last character is not lowercase alphabeT'" 0;
TestReturnCode "${T1} 'chore: This is a valid title'" 0;
TestReturnCode "${T1} 'ci: This is a valid title'" 0;
TestReturnCode "${T1} 'docs: This is a valid title'" 0;
Expand All @@ -48,5 +51,3 @@ TestReturnCode "${T1} 'refactor: This is a valid title'" 0;
TestReturnCode "${T1} 'test: This is a valid title'" 0;
TestReturnCode "${T1} 'tools: This is a valid title'" 0;
TestReturnCode "${T1} 'bot: Bump github.com/alternativesourcenetwork/defradb from 1.1.0.1.0.0 to 1.1.0.1.0.1'" 0;
TestReturnCode "${T1} 'bot Bump github.com/alternativesourcenetwork/defradb from 1.1.0.1.0.0 to 1.1.0.1.0.1'" 3;
TestReturnCode "${T1} 'bot Bump github.com/short/short from 1.2.3 to 1.2.4'" 4;
8 changes: 4 additions & 4 deletions tools/scripts/validate-conventional-style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fi

CHECK_SPACE="${DESCRIPTION::1}"; # First character
CHECK_FIRST_UPPER_CASE="${DESCRIPTION:1:1}"; # Second character
CHECK_LAST_LOWER_CASE_OR_NUM="${DESCRIPTION: -1}"; # Last character
CHECK_LAST_VALID="${DESCRIPTION: -1}"; # Last character

# Validate that there is a space between the label and description.
if [ "${CHECK_SPACE}" != " " ]; then
Expand All @@ -81,9 +81,9 @@ if [[ "${CHECK_FIRST_UPPER_CASE}" != [A-Z] ]]; then
exit 7;
fi

# Validate that the last character is a lower case alphabet or a number character.
if [[ "${CHECK_LAST_LOWER_CASE_OR_NUM}" != [a-z0-9] ]]; then
printf "Error: Last character is neither a lowercase alphabet nor a number.\n";
# Validate that the last character is a valid character.
if [[ "${CHECK_LAST_VALID}" != [a-zA-Z0-9] ]]; then
printf "Error: Last character is an invalid character.\n";
exit 8;
fi

Expand Down