Skip to content

Commit 4851902

Browse files
committed
feat: update get-translations.ts
extract env vars to single-declaration; remove sleep and replace with awaitLatestBuild script; move timing to AM,
1 parent e99cf23 commit 4851902

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

.github/workflows/get-translations.yml

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ name: Crowdin CI
22

33
on:
44
schedule:
5-
- cron: "20 16 1 * *" # Runs at 4:20 PM on the first day of every month
5+
- cron: "20 4 1 * *" # Runs at 4:20 AM on the first day of every month
66
workflow_dispatch: # Can be dispatched manually
77

88
jobs:
99
create_approved_language_bucket_prs:
1010
runs-on: ubuntu-latest
11+
env:
12+
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
13+
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
1116
steps:
1217
# Set up environment
1318
- name: Check out code
@@ -39,28 +44,17 @@ jobs:
3944
# Build and prepare translations
4045
- name: Build Crowdin project
4146
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/triggerBuild.ts
42-
env:
43-
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
44-
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
4547

46-
- name: Sleep while Crowdin build finishes
47-
run: sleep 3600 # in seconds (1 hour)
48+
- name: Await latest build to finish
49+
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/awaitLatestBuild.ts
4850

4951
- name: Get latest translation bucket directory ids
5052
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/getBucketDirectoryIds.ts
51-
env:
52-
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
53-
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
5453

5554
# Import approved translations
5655
- name: Get translations
5756
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/getTranslations.ts
58-
env:
59-
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
60-
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
6157

6258
# Post updates as language-specific PRs
6359
- name: Process commits and post PRs by language
6460
run: npx ts-node -O '{"module":"commonjs"}' ./src/scripts/crowdin/translations/postLangPRs.ts
65-
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)