From 700428d740dfea7e70a862ec479d1adc5f015e9a Mon Sep 17 00:00:00 2001 From: Pierre Slamich Date: Mon, 28 Aug 2023 14:57:43 +0200 Subject: [PATCH] Create check_strings.yml --- .github/workflows/check_strings.yml | 35 +++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/check_strings.yml diff --git a/.github/workflows/check_strings.yml b/.github/workflows/check_strings.yml new file mode 100644 index 000000000000..87aa0342fac7 --- /dev/null +++ b/.github/workflows/check_strings.yml @@ -0,0 +1,35 @@ +name: Check Forbidden Strings in index.html + +on: + push: + paths: + - 'lang/**/texts/index.html' + pull_request: + paths: + - 'lang/**/texts/index.html' + +jobs: + check_strings: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install prerequisites + run: sudo apt-get install -y grep + + - name: Check for forbidden strings + run: | + FORBIDDEN_STRINGS=("Open Pet Food Facts" "Open Beauty Facts" "Open Products Facts") + FILES=$(find ./lang/ -name 'index.html' -path '*/texts/*') + + for file in $FILES; do + for string in "${FORBIDDEN_STRINGS[@]}"; do + if grep -q "$string" "$file"; then + echo "Error: '$string' found in $file" + exit 1 + fi + done + done + echo "No forbidden strings found."