diff --git a/.github/workflows/pull_requests.yml b/.github/workflows/pull_requests.yml index a455b2dabd..94ec97fe12 100644 --- a/.github/workflows/pull_requests.yml +++ b/.github/workflows/pull_requests.yml @@ -68,4 +68,33 @@ jobs: for target in "${targets[@]}"; do swift package plugin generate-documentation --target "$target" --warnings-as-errors --analyze --level detailed - done \ No newline at end of file + done + + acceptable-language-check: + name: Acceptable language check + runs-on: ubuntu-latest + timeout-minutes: 1 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Run acceptable language check + shell: bash + run: | + set -euo pipefail + + log() { printf -- "** %s\n" "$*" >&2; } + error() { printf -- "** ERROR: %s\n" "$*" >&2; } + fatal() { error "$@"; exit 1; } + + UNACCEPTABLE_WORDS="blacklist|whitelist|slave|master|sane|sanity|insane|insanity|kill|killed|killing|hang|hung|hanged|hanging" + + log "Checking for unacceptable language..." + PATHS_WITH_UNACCEPTABLE_LANGUAGE=$(git grep \ + -l -F -w -E ${UNACCEPTABLE_WORDS} \ + ) || true | /usr/bin/paste -s -d " " - + + if [ -n "${PATHS_WITH_UNACCEPTABLE_LANGUAGE}" ]; then + fatal "❌ Found unacceptable language in files: ${PATHS_WITH_UNACCEPTABLE_LANGUAGE}." + fi + + log "✅ Found no unacceptable language." \ No newline at end of file