diff --git a/.github/workflows/manual.yml b/.github/workflows/manual.yml new file mode 100644 index 0000000..f40b3f8 --- /dev/null +++ b/.github/workflows/manual.yml @@ -0,0 +1,15 @@ +LC_ALL=C + +local_branch="$(git rev-parse --abbrev-ref HEAD)" + +valid_branch_regex="([a-z]{2}\d{1,6}-[a-z]{5}-\d{4})+$" + +message="There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. Your commit will be rejected. You should rename your branch to a valid name and try again." + +if [[ ! $local_branch =~ $valid_branch_regex ]] +then + echo "$message" + exit 1 +fi + +exit 0 diff --git a/hooks b/hooks new file mode 100644 index 0000000..dc4c75c --- /dev/null +++ b/hooks @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +LC_ALL=C + +local_branch="$(git rev-parse --abbrev-ref HEAD)" + +valid_branch_regex="([a-z]{2}\d{1,6}-[a-z]{5}-\d{4})+$" + +message="There is something wrong with your branch name. Branch names in this project must adhere to this contract: $valid_branch_regex. Your commit will be rejected. You should rename your branch to a valid name and try again." + +if [[ ! $local_branch =~ $valid_branch_regex ]] +then + echo "$message" + exit 1 +fi + +exit 0 diff --git a/m3/backend.tf b/m3/backend.tf index 43255d8..e8c0240 100644 --- a/m3/backend.tf +++ b/m3/backend.tf @@ -5,3 +5,5 @@ terraform { prefix = "m3/gcs_state" } } + +