chore: prevent translation changes being merged without the correct configurations #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Translation Changes | |
on: | |
pull_request: | |
paths: | |
- '**/assets/translations/**' | |
jobs: | |
check-translations: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Fetch all history for all branches and tags | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' | |
- name: Run translation change script | |
run: | | |
BASE_COMMIT=${{ github.event.pull_request.base.sha }} | |
HEAD_COMMIT=${{ github.event.pull_request.head.sha }} | |
changed_files=$(git diff --name-only $BASE_COMMIT $HEAD_COMMIT | grep 'assets/translations') | |
if [ -n "$changed_files" ]; then | |
for file in $changed_files; do | |
folder_path=$(dirname "$(dirname "$file")") | |
echo "Changes detected in $folder_path" | |
sh ./ci-scripts/check-translation.sh "$folder_path" | |
done | |
else | |
echo "No translation changes detected" | |
fi |