aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniil Cherednik <dcherednik@yandex-team.ru>2022-04-12 16:58:57 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-04-12 16:58:57 +0300
commit080276733272854f1059ef73dbd17918ee12cb0d (patch)
treeed115fdecb9828b9d47c995b7ce9ad0120f95081
parentfae5cfea7a074b21c1d31a3273f85b5687f90955 (diff)
downloadydb-080276733272854f1059ef73dbd17918ee12cb0d.tar.gz
github action to check allowed dirs. KIKIMR-14703
ref:6ad5aeb6e823636e7319379ff08cfffc00f1ab60
-rwxr-xr-x.github/check_dirs.sh33
-rw-r--r--.github/workflows/allowed_dirs.yml17
2 files changed, 50 insertions, 0 deletions
diff --git a/.github/check_dirs.sh b/.github/check_dirs.sh
new file mode 100755
index 0000000000..ba1e685a37
--- /dev/null
+++ b/.github/check_dirs.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+GIT_URL=$1
+
+set -e
+declare -A top_dirs=(
+ [ydb/]=1,
+ [util/]=1,
+ [build/]=1,
+ [contrib/]=1,
+ [certs/]=1,
+ [cmake/]=1,
+ [.git/]=1,
+ [.github/]=1,
+ [library/]=1,
+ [tools/]=1,
+)
+
+cd $GIT_URL
+
+shopt -s dotglob
+shopt -s nullglob
+array=(*/)
+
+for dir in "${array[@]}"
+do
+ if [[ ! ${top_dirs[$dir]} ]]
+ then
+ echo "$dir is not allowed root level directory."
+ exit 1
+ fi
+done
+
diff --git a/.github/workflows/allowed_dirs.yml b/.github/workflows/allowed_dirs.yml
new file mode 100644
index 0000000000..c2b997abec
--- /dev/null
+++ b/.github/workflows/allowed_dirs.yml
@@ -0,0 +1,17 @@
+name: CheckAllowedDirs
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+
+ - name: Check dirs
+ run: ${{github.workspace}}/.github/check_dirs.sh ${{github.workspace}}