Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/i18n-guard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: i18n guard

on:
pull_request_target:
types: [opened, synchronize, reopened, labeled, unlabeled]
Comment thread
coderabbitai[bot] marked this conversation as resolved.

permissions:
contents: read
pull-requests: read

jobs:
guard:
runs-on: ubuntu-latest
steps:
- name: Block edits to translated language files
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
PR: ${{ github.event.pull_request.number }}
OVERRIDE: ${{ contains(github.event.pull_request.labels.*.name, 'allow-i18n-edit') }}
run: |
if [ "$OVERRIDE" = "true" ]; then
echo "allow-i18n-edit label present, skipping."
exit 0
fi
files=$(gh api "repos/$REPO/pulls/$PR/files" --paginate --jq '.[].filename')
changed=$(printf '%s\n' "$files" | grep '^i18n/.*\.json$' | grep -v '^i18n/en-US\.json$' || true)
if [ -z "$changed" ]; then
exit 0
fi
echo "Translations are managed by Crowdin, edit i18n/en-US.json only."
echo "Revert these files:"
echo "$changed"
exit 1
Loading