We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 80c3c95 + 33ccb65 commit 20b537aCopy full SHA for 20b537a
pre-receive-hooks/restrict-master-to-cli.sh
@@ -0,0 +1,17 @@
1
+#!/bin/bash
2
+#
3
+# This hook restricts changes on the default branch to disallow the Web UI blob editor
4
5
+DEFAULT_BRANCH=$(git symbolic-ref HEAD)
6
+while read -r oldrev newrev refname; do
7
+ if [[ "${refname}" != "${DEFAULT_BRANCH:=refs/heads/master}" ]]; then
8
+ continue
9
+ else
10
+ if [[ "${GITHUB_VIA}" = 'blob#save' ]]; then
11
+ echo "Changes to the default branch must be made by cli. Web UI edits are not allowed."
12
+ exit 1
13
14
15
+ fi
16
17
+done
0 commit comments