Spaces:
Paused
Paused
Upload .github\workflows\translate-i18n-base-on-english.yml with huggingface_hub
Browse files
.github//workflows//translate-i18n-base-on-english.yml
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: Check i18n Files and Create PR
|
| 2 |
+
|
| 3 |
+
on:
|
| 4 |
+
pull_request:
|
| 5 |
+
types: [closed]
|
| 6 |
+
branches: [main]
|
| 7 |
+
|
| 8 |
+
jobs:
|
| 9 |
+
check-and-update:
|
| 10 |
+
if: github.event.pull_request.merged == true
|
| 11 |
+
runs-on: ubuntu-latest
|
| 12 |
+
defaults:
|
| 13 |
+
run:
|
| 14 |
+
working-directory: web
|
| 15 |
+
steps:
|
| 16 |
+
- uses: actions/checkout@v4
|
| 17 |
+
with:
|
| 18 |
+
fetch-depth: 2 # last 2 commits
|
| 19 |
+
persist-credentials: false
|
| 20 |
+
|
| 21 |
+
- name: Check for file changes in i18n/en-US
|
| 22 |
+
id: check_files
|
| 23 |
+
run: |
|
| 24 |
+
recent_commit_sha=$(git rev-parse HEAD)
|
| 25 |
+
second_recent_commit_sha=$(git rev-parse HEAD~1)
|
| 26 |
+
changed_files=$(git diff --name-only $recent_commit_sha $second_recent_commit_sha -- 'i18n/en-US/*.ts')
|
| 27 |
+
echo "Changed files: $changed_files"
|
| 28 |
+
if [ -n "$changed_files" ]; then
|
| 29 |
+
echo "FILES_CHANGED=true" >> $GITHUB_ENV
|
| 30 |
+
else
|
| 31 |
+
echo "FILES_CHANGED=false" >> $GITHUB_ENV
|
| 32 |
+
fi
|
| 33 |
+
|
| 34 |
+
- name: Set up Node.js
|
| 35 |
+
if: env.FILES_CHANGED == 'true'
|
| 36 |
+
uses: actions/setup-node@v2
|
| 37 |
+
with:
|
| 38 |
+
node-version: 'lts/*'
|
| 39 |
+
|
| 40 |
+
- name: Install dependencies
|
| 41 |
+
if: env.FILES_CHANGED == 'true'
|
| 42 |
+
run: pnpm install --frozen-lockfile
|
| 43 |
+
|
| 44 |
+
- name: Run npm script
|
| 45 |
+
if: env.FILES_CHANGED == 'true'
|
| 46 |
+
run: pnpm run auto-gen-i18n
|
| 47 |
+
|
| 48 |
+
- name: Create Pull Request
|
| 49 |
+
if: env.FILES_CHANGED == 'true'
|
| 50 |
+
uses: peter-evans/create-pull-request@v6
|
| 51 |
+
with:
|
| 52 |
+
commit-message: Update i18n files based on en-US changes
|
| 53 |
+
title: 'chore: translate i18n files'
|
| 54 |
+
body: This PR was automatically created to update i18n files based on changes in en-US locale.
|
| 55 |
+
branch: chore/automated-i18n-updates
|