Skip to content

Commit

Permalink
[GHA] Unacceptable language check
Browse files Browse the repository at this point in the history
# Motivation

Next up replacing part of our soundness script that checked for unacceptable language.

# Modification

This PR adds a new GH action that checks for unacceptable language.

# Result

One more script replaced
  • Loading branch information
FranzBusch committed Jul 4, 2024
1 parent 9730938 commit 904df5c
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion .github/workflows/pull_requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,33 @@ jobs:
for target in "${targets[@]}"; do
swift package plugin generate-documentation --target "$target" --warnings-as-errors --analyze --level detailed
done
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."

0 comments on commit 904df5c

Please sign in to comment.