diff --git a/.github/scripts/notests.sh b/.github/scripts/notests.sh new file mode 100755 index 0000000000..65864acaa2 --- /dev/null +++ b/.github/scripts/notests.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +FORBIDDEN_DIR="docs/unified-test-documentation" + +# Get the list of files added in the current commit +added_files=$(git diff --name-only --diff-filter=A origin/master) + +# Check if any added file is within the forbidden directory +if [[ -n "$added_files" ]]; then + for file in $added_files; do + if [[ "$file" == "$FORBIDDEN_DIR/"* ]]; then + echo "Error: Files cannot be added to $FORBIDDEN_DIR" + echo "Submit tests to the OSFV repo instead" + exit 1 + fi + done +fi + +exit 0 diff --git a/.github/workflows/notests.yml b/.github/workflows/notests.yml new file mode 100644 index 0000000000..c6ab1faff6 --- /dev/null +++ b/.github/workflows/notests.yml @@ -0,0 +1,20 @@ +--- +name: Reject new tests +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + fail_on_test: + runs-on: ubuntu-latest + name: Reject new tests + steps: + - name: Checkout repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - run: .github/scripts/notests.sh