diff options
author | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-04-12 13:30:20 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-04-12 14:32:40 +0300 |
commit | 6aff4cb8c380f6014d13dac9a09cb35278f611c9 (patch) | |
tree | 2564d7c8894735e597a48745727b3e13d68ffe2d /.github | |
parent | f6b96514d12688d3e68b8576dd4ccce1c8ec9ac0 (diff) | |
download | ydb-6aff4cb8c380f6014d13dac9a09cb35278f611c9.tar.gz |
github action to check allowed top level dirs.
Diffstat (limited to '.github')
-rwxr-xr-x | .github/check_dirs.sh | 32 | ||||
-rw-r--r-- | .github/workflows/allowed_dirs.yml | 17 |
2 files changed, 49 insertions, 0 deletions
diff --git a/.github/check_dirs.sh b/.github/check_dirs.sh new file mode 100755 index 0000000000..8301285379 --- /dev/null +++ b/.github/check_dirs.sh @@ -0,0 +1,32 @@ +#!/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, + [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}} |