Skip to content

Commit

Permalink
Add support for fixing dependabot branches in githooks
Browse files Browse the repository at this point in the history
  • Loading branch information
hwinther committed Nov 6, 2024
1 parent ad96473 commit 994554e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .githooks/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ MAIN_BRANCH="main"

current_branch="$(git rev-parse --abbrev-ref HEAD)"

if [[ $current_branch =~ dependabot/.* ]]; then
exit 0
fi

case "$current_branch" in
$DEV_BRANCH)
error_msg="Aborting commit. Please use the following format: <Imperative verb> <short description of change>"
Expand Down
2 changes: 1 addition & 1 deletion .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ source .githooks/config.sh
local_branch="$(git rev-parse --abbrev-ref HEAD)"

# valid_branch_regex="^(feature|bugfix|improvement|library|prerelease|release|hotfix)\/[a-z0-9._-]+$"
valid_branch_regex="^(main|qa|test|dev|${BRANCH_PREFIXES}\/${JIRA_TAG}-[0-9]+-[A-Za-z0-9-]+)$"
valid_branch_regex="^(main|qa|test|dev|${BRANCH_PREFIXES}\/${JIRA_TAG}-[0-9]+-[A-Za-z0-9-]+|dependabot/.*)$"

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."

Expand Down

0 comments on commit 994554e

Please sign in to comment.