Skip to content

Commit 8b94d88

Browse files
committed
feat: automated crowdin sync
1 parent 38a8a5d commit 8b94d88

File tree

4 files changed

+55
-44
lines changed

4 files changed

+55
-44
lines changed

.github/workflows/translations-pr.yml renamed to .github/workflows/translations-pr-lint-and-format.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# This Workflow is used to comment on PRs that have changes that touch Translated Files
22
# and then comments on their PRs mentioning that they should not do so
3+
# It also formats incoming content because it is often not adherent to our rules post-translation.
34

4-
name: Crowdin Checks
5+
name: Incoming Translation Checks
56

67
on:
78
pull_request_target:

.github/workflows/translations-pr2.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This action automates the synchronization of our crowdin translations, so that a human does not need to kick it off from the crowdin UI
2+
# See translations-pr-line-and-format.yml for quality control we conduct on ingress of new translations.
3+
name: Crowdin Sync
4+
5+
on:
6+
schedule:
7+
- cron: '0 5 * * 5' # At 05:00 on Fridays. This guarantees that we have the 72 hour weekend time to review translations.
8+
9+
# Cancel any runs on the same branch
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
permissions:
15+
# These permissions required by `crowdin/github-action`
16+
contents: write
17+
pull-requests: write
18+
19+
jobs:
20+
synchronize-with-crowdin:
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Harden Runner
25+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
26+
with:
27+
egress-policy: audit
28+
29+
- name: Checkout
30+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
31+
32+
# see all the options at https://github.com/crowdin/github-action
33+
- name: crowdin action
34+
uses: crowdin/github-action@2d540f18b0a416b1fbf2ee5be35841bd380fc1da #v2.3.0
35+
with:
36+
upload_sources: true
37+
upload_translations: false #do not upload existing translations - this is a one-way operation
38+
# the rest of this controls how the PR comes in with new translations
39+
download_translations: true
40+
localization_branch_name: chore/crowdin
41+
create_pull_request: true
42+
pull_request_title: '[automated]: crowdin sync'
43+
pull_request_body: 'New Crowdin translations from the [Node.js Crowdin project](https://crowdin.com/project/nodejs-web)'
44+
pull_request_labels: github_actions:pull-request
45+
commit_message: 'chore: synced translations from crowdin [skip ci]'
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
48+
# A numeric ID, found at https://crowdin.com/project/nodejs-web/tools/api
49+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
50+
# Created from https://crowdin.com/settings#api-key logged in using nodejs-crowdin-bot
51+
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

crowdin.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
commit_message: 'chore: synced translations from crowdin [skip ci]'
1+
project_id_env: 'CROWDIN_PROJECT_ID'
2+
api_token_env: 'CROWDIN_PERSONAL_TOKEN'
23
append_commit_message: false
3-
pull_request_title: '[automated]: crowdin sync'
4-
pull_request_labels:
5-
- 'github_actions:pull-request'
64
files:
75
- source: /apps/site/pages/en/**/*.md
86
translation: /apps/site/pages/%two_letters_code%/**/%original_file_name%

0 commit comments

Comments
 (0)