Affrae add block_branch_names_not_starting_with_userID.sh - #144
Conversation
mzzmjd
left a comment
There was a problem hiding this comment.
Great Idea 👍
Are lines 30 to 32 necessary?
Someone has entered the correct details, do we need to tell them that they have entered the correct details?
| if [[ $oldrev == $zero_commit && $refname =~ ^refs/heads/ ]]; then | ||
| # Check if the branch name is lower case characters (ASCII only), '-', '_', "/" or numbers | ||
| if [[ ! $refname =~ ^refs/heads/$GITHUB_USER_LOGIN ]]; then | ||
| echo "Hi, $GITHUB_USER_LOGIN Blocking creation of new branch $refname" |
There was a problem hiding this comment.
Should this line be:
echo "Hi $GITHUB_USER_LOGIN, Blocking creation of new branch $refname"
Move the comma so that the message reads:
Hi affrae, Blocking creation of new branch BRANCH-NAME"
There was a problem hiding this comment.
@affrae Forgot to kick off a review of this line?
This is me being pedantic over English grammar. I can remember that English lesson 👨🏫 at school 🏫 all be it over 40 years ago. 👴
| fi | ||
| fi | ||
| done | ||
| echo "Hi, $GITHUB_USER_LOGIN allowing creation of new branch $refname" |
There was a problem hiding this comment.
Should this line be:
echo "Hi $GITHUB_USER_LOGIN, allowing creation of new branch $refname"
Move the comma so that the message reads:
Hi affrae, allowing creation of new branch affraeBRANCH-NAME
There was a problem hiding this comment.
@mzzmjd That's a good point - I use this particular message in my demo to show that it does not have to be an error message passed back. I can remove it if you like - just let me know!
There was a problem hiding this comment.
That's fine. 👍
Anyone that picks up these scripts may make some tweaks to suit their setup.
|
@mzzmjd I have chosen to comment out the lines but not remove them - thus they can be added for demo purposes when required, as opposed to by default. |
|
Thanks, @jonico |
I get asked about branch naming conventions a lot - so I usually show this as a pre-receive hook.
There is one caveat: this comparison is currently case sensitive.