From 61944def17ec3a188d4ab2f730077a7949b812fc Mon Sep 17 00:00:00 2001 From: Yassin Kortam Date: Wed, 11 Nov 2026 20:19:58 -0800 Subject: [PATCH] ci: fail when the repo root grows past 15 entries (#51007) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .github/workflows/root-entry-limit.yml | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/root-entry-limit.yml diff --git a/.github/workflows/root-entry-limit.yml b/.github/workflows/root-entry-limit.yml new file mode 100644 index 00000000000..118f03073f0 --- /dev/null +++ b/.github/workflows/root-entry-limit.yml @@ -0,0 +1,27 @@ +name: Root entry limit + +on: + pull_request: {} + push: + branches: [main] + +permissions: + contents: read + +jobs: + root-entry-limit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 + with: + persist-credentials: false + - name: Check root entry count + env: + MAX_ROOT_ENTRIES: 15 + run: | + count=$(find . -mindepth 1 -maxdepth 1 -printf '.\n' | wc -l) + echo "Root has $count entries. Maximum is $MAX_ROOT_ENTRIES." + if [ "$count" -gt "$MAX_ROOT_ENTRIES" ]; then + echo "::error::Repository root exceeds $MAX_ROOT_ENTRIES entries. Move new files into an existing directory." + exit 1 + fi