debian-mirror-gitlab/.lefthook/pre-push/security_harness
2023-06-20 00:43:36 +05:30

17 lines
544 B
Bash
Executable file

#!/usr/bin/env bash
set -e
shopt -s nocasematch # Enable case-insensitive matching
local_branch="$(git rev-parse --abbrev-ref HEAD)"
security_branch_regex="^security.+"
url="$2"
if [[ $local_branch =~ $security_branch_regex ]] && [[ "$url" != *"gitlab-org/security/"* ]]
then
echo "Pushing security branches to remotes other than gitlab.com/gitlab-org/security has been disabled!"
echo "Please read https://gitlab.com/gitlab-org/release/docs/blob/master/general/security/developer.md#do-not-push-to-gitlab-orggitlab"
echo
exit 1
fi